FDEInterviews logo
Coding & DSA / 73
hard★ EssentialGoogleMetaAdobe

Compute the edit distance (Levenshtein) between two strings.

A DP classic that screens for one thing: can you define the right subproblem and fill the table without fumbling the indices. The strong version adds the O(min(m,n)) space trick and reconstructs the actual edits when the follow-up lands.

Updated Aug 2026 · Grounded in real Forward Deployed Engineer interview loops and written to a senior-engineer editorial bar.

A DP classic that screens for one thing: can you define the right subproblem and fill the table without fumbling the indices. The strong version adds the O(min(m,n)) space trick and reconstructs the actual edits when the follow-up lands.

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 state is the whole question. If you can say 'dp[i][j] is the distance between the first i chars of a and the first j chars of b' and then justify the three transitions, you pass. Candidates who jump to code without naming the state almost always botch the base row or the off-by-one in the loop bounds.

DISCUSSION · 0

No comments yet — be the first to share your approach.