Dashboard
LC #354
Russian Doll Envelopes
Pattern · ?GoogleAmazonBloomberg
Problem
Find the maximum number of envelopes you can nest (each must be strictly larger in both dimensions).
Constraints
- 1 ≤ envelopes.length ≤ 10⁵
- envelopes[i].length == 2
- 1 ≤ wi, hi ≤ 10⁵
Example
- Input
- envelopes = [[5,4],[6,4],[6,7],[2,3]]
- Output
- 3
- Why
- [2,3] → [5,4] → [6,7] — each strictly fits inside the next
Spot the pattern
Which pattern cracks it?
Hints
One at a time