FDEInterviews logoFDE/Interviews
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.

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.

Unlock the other 466 answers · ₹2,000 / $25Your progress and mastery stay saved · 6 months · one payment · no auto-renew
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.