Problem 993 · Easy

Cousins in Binary Tree

Two nodes are cousins when they sit at the same depth under different parents; a breadth-first walk records both.

Open the interactive visualisation