DEV Community

Alexander Kazanski
Alexander Kazanski

Posted on

BFS with a queue is the cleanest way to visit a tree level by level. Great for 'return nodes at depth k' problems — here's the template.

Top comments (0)