Edit Distance Between a Spoken Pickup Address and Its Canonical Form
Last updated: November 29, 2026
Quick Overview
Voice input produces a transcribed pickup address; given the transcription and a canonical address from the places index, return the minimum number of character insertions, deletions and substitutions needed to turn one into the other.
Uber
November 29, 20260
0
0 solved
Voice input produces a transcribed pickup address; given the transcription and a canonical address from the places index, return the minimum number of character insertions, deletions and substitutions needed to turn one into the other.
Uber matches noisy rider input (typed or spoken) to known places, and string similarity is a building block for ranking candidates. The technical screen checks the classic 2D DP, the reasoning behind each transition, and the rolling-array space optimization.
What the Interviewer Expects
- Define dp[i][j] on prefixes of both strings
- Explain the three transitions and the free match
- Initialize the first row and column correctly
- Reduce space to O(min(m, n)) with a rolling row
- Discuss normalization before comparing (case, abbreviations)
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you weight substitutions between keyboard-adjacent or phonetically similar characters?
- How would you find the best match among 10 million addresses without computing full distances?
- What changes if transpositions count as one edit (Damerau)?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: strings
aandb. - Operations: insert, delete, substitute one character, each cost 1.
- Output: minimum total operations.
- Normalize first (lowercase,
SttoStreet), since the DP its...
High-Level Design
Let dp[i][j] be the distance between a[:i] and b[:j]. Base cases: dp[i][0] = i deletions and dp[0][j] = j insertions. If a[i-1] == b[j-1], dp[i][j] = dp[i-1][j-1]. Otherwise take 1 plus ...