VisualizeCode.Dyev
Runner ready

Medium · Graph

BFS Shortest Path

Explore a graph in breadth-first order to reach a target.

Reference test case

Input: [2, 7, 11, 15], target = 9
Expected output: [0, 1]