DeepOffer

Compute the edit distance between two strings.

ML CodingReported interview question
Reported in interviews — Meta (trending 3 months ago, Oct 2026)

Use dynamic programming where dp[i][j] is the minimum inserts, deletes, or substitutions for the first i and j characters. Each cell takes the best predecessor plus cost; roll rows for O(min(m,n)) space.

Test empty input, one-element input, duplicates, boundary indices, invalid states, and the largest allowed size; state time and space complexity.

Common follow-up questions

Practice this question with an AI interviewer

Get asked follow-ups live, then receive a scored report — like a real MLE interview loop.

Start AI mock interview