Doordash Technical Phone Screen (Senior Level)

2460
Jul 28, 2022

Format was simple, 5 mins initial introduction then 45 mins for 2 questions and last 10 mins for asking questions.

Question 1. Given a restaurant name and another list of restaurant names, find out the restaurant names from list which can be obtained by swapping exactly two characters in the original name.

Eg:
Restaurant name: "hotpot"
Restaurant list: ["hottop", "hotpit", "poohtt"]
Ans: ["hottop"] as "p" and "t" are swapped. For hotpit we have a totally different character. The third one is obtained by performing two swaps, hence will not be in the answer.

Expectation was simple O(n) solution per query string.
Approach I took: Comparing the two strings and finding which position they differ on and then using these positions to cross compare the alphabets worked out.

Question 2: Variation of https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-anagram/

Comments (6)