DoorDash Coding Interview: One-Swap Name Matcher
Based on questions reported for DoorDash interviews
The interviewer opens
Hi, and thanks for joining me today. Welcome to your interview for the software engineer role at DoorDash. We'll work through one coding problem together, and I'd like you to think out loud as you code. If you need to step out or take a break, the Pause button at the top right will stop things at any time.
The problem is about spotting likely typos in customer names, which is the kind of cleanup a support tool at a delivery company might do. It's in the Problem tab on the right, so please read it through, take your time, and ask me anything before you start.
The problem
A support tool flags names that may be typos of a customer's name.
original: the customer's name (lowercase letters).names: a list of candidate names (lowercase letters).
Return, in input order (keeping duplicates), every name that becomes exactly original after swapping the letters at two different positions in it. A name identical to original qualifies only if such a swap leaves it unchanged, which happens when it contains some letter twice.
Example: original = "dasher", names = ["dahser", "sadher", "dasher", "rashed", "dashe"] → ["dahser", "sadher", "rashed"]
Sizes: up to 10^4 names, each up to 100 letters.