Minimum BFS Length
Jack is learning [Breadth first search](https://en.wikipedia.org/wiki/Breadth-first_search#BFS_ordering) on [trees](https://en.wikipedia.org/wiki/Tree_(data_structure)). He creates the actual structure of tree on the ground with $N$ nodes where each edge is of **unit length**. Initially, he stands on node $1$ and starts performing `BFS` on this tree. Since he is lazy, he asks you to find the
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start