dsa7 min read
Russian Doll Envelopes — 2D LIS with the Tie-Breaker Trick
LeetCode 354 Russian Doll Envelopes is a sneaky 2D Longest Increasing Subsequence problem. Sort by width ascending and height descending so equal widths cannot stack, then run patience-sort LIS on heights for an O(n log n) DP solution beloved by FAANG interviewers.
Read →