NeetCode #587LC-1129MediumGraphs
← Back to All Problems#587 · #1129 · Shortest Path with Alternating Colors(颜色交替的最短路径)
📌 Problem Statement & Constraints
You are given a directed graph with red edges and blue edges. Return the shortest path length from node 0 to each node such that the edge colours alternate; return -1 for unreachable nodes. Constraints:
1 <= n <= 100, 0 <= redEdges.length, blueEdges.length <= 400.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!