DSA Key Problems

Shortest Path with Alternating Colors

Given red and blue directed edges, return for every vertex the shortest distance from vertex 0 along a path whose edge colors alternate, using -1 for unreachable vertices.