Sponsored
Use these hints if you're stuck. Try solving on your own first.
Do a breadth-first search, where the "nodes" are actually (Node, color of last edge taken).
Solve with full IDE support and test cases