Almost everyone reaches the O(n²) DP. The signal interviewers want is the O(n log n) patience-sorting trick, plus the honesty to say the array you build along the way is not itself the answer subsequence.
← Coding & DSA / 74
mediumGoogleMicrosoft
Find the length of the longest increasing subsequence.
Almost everyone reaches the O(n²) DP. The signal interviewers want is the O(n log n) patience-sorting trick, plus the honesty to say the array you build along the way is not itself the answer subsequence.
Updated Aug 2026 · Grounded in real Forward Deployed Engineer interview loops and written to a senior-engineer editorial bar.
20 answers per topic instead of 10, plus saved progress and bookmarks · no cardor unlock all 528 remaining answers · ₹2,000 / $25
UP NEXT ON YOUR JOURNEY
FEDITOR'S NOTE
The trap in the n log n version is believing the 'tails' array is the LIS. It is not; only its length is correct. Candidates who claim otherwise get handed an input where the tails array is a sequence that never appeared, and watching them realize it is half the test.
DISCUSSION · 0
No comments yet — be the first to share your approach.
