Dashboard
LC #199
Binary Tree Right Side View
Pattern · ?AmazonGoogleMetaBloomberg
Problem
Return the values of the nodes you can see from the right side of the tree (rightmost node per level).
Constraints
- 0 ≤ n ≤ 100
- -100 ≤ Node.val ≤ 100
Example
- Input
- root = [1, 2, 3, null, 5, null, 4]
- Output
- [1, 3, 4]
- Why
- Rightmost node per level: 1 (L0), 3 (L1), 4 (L2)
Spot the pattern
Which pattern cracks it?
Hints
One at a time