Untitled

Pasted by Anonymous on Thu Nov 5 17:11:44 2026 UTC as Rendered markdown

Cousins in Binary Tree (LeetCode 993)

Goal

Check if two nodes are same depth but different parents.

Approach

BFS track parent+depth for x and y; compare once both found.

Tip

One pass BFS is enough — store two (parent, depth) pairs.

Review BFS family checks via real-time interview help.