- Published on
Doordash Phone Screen | E4 SWE | Passed
- Author
- Shared Anonymously
I got asked the "distance from Dashmarts" graph question that some other posted, but basically it's https://leetcode.com/problems/01-matrix/description/
Experience:
I mentioned that we can start the BFS from all the "1"'s at once, which takes O(MN), and is optimal.
Interviewer asked me to write down a quick pseudo code before implementing.
Implemented, compiled and ran the test cases (which were already given by the interviewers). Got compiling error due to a small bug; fixed that immediately, all test cases passed
At which point ran out of time. Interviewer said they had a follow up but don't worry about that.
Recruiter called in 2 business days said I'm going to onsite.
I think a few folks mentioned they got the optimal solution and even got the follow up; so I'm not sure why I got passed. I guess I was lucky. But I think a few points that may have helped me pass even when I didn't get to the follow up:
- I didn't give the optimal solution right away. I started with an inefficient solution then (because that's the only one I could think of initially) then acklowledged that "that's still very inefficient, give me a minute to think of a more efficient way", and eventually arrived at the optimal one.
- I factored out my code. I don't know how much that helped, but I do that in every coding interview I've been to. (factor out things like
getNeighbors
, defined constants likeONE = "1"
instead of hardcoding "1" into the main code), as they mentioned the code need to be production quality so I think little things like that may count.
I'm having onsite next week.