Solve Russian Doll Envelopes from LeetCode. You have envelopes with width and height. One envelope fits inside another if both dimensions are strictly smaller. Find the maximum number of envelopes you can nest.
Hint: Sort by width ascending, then by height descending within same width. Then find LIS on heights. Why does this work? Take time to work through examples. The pattern becomes clearer with practice.