Shortest path in a graph where all edges have equal weight (solved with BFS).
Asked in the OA stage. OA question 1 of 2, 90 minutes total.
Implement shortest_path(n, edges, start, target). The graph has vertices 0 through n - 1, and each edge is undirected. Return the minimum number of edges from start to target, or -1 if no path exists.
def shortest_path(n, edges, start, target):