1602. Find Nearest Right Node in Binary Tree
TreeBreadth-First SearchBinary Tree
Hints
Hint 1
Use BFS, traverse the tree level by level and always push the left node first
Hint 2
When you reach the target node, mark a boolean variable true
Hint 3
If you meet another node in the same level after marking the boolean true, return this node.
Hint 4
If you did not meet new nodes in the same level and started traversing a new level, return Null
Preparing judge…