Apple Tech Phone Screen: Shortest Path Algorithm Challenge
Interview Experience
The question was roughly about finding the shortest path between two points. Each edge has a cost of 1. Simple, right? The interviewer said the number of nodes is around 200, so this function will be
Full Details
The question was roughly about finding the shortest path between two points. Each edge has a cost of 1. Simple, right? The interviewer said the number of nodes is around 200, so this function will be called many times. I said, "Then we can pre-compute the distance between each point, store it, and return an O(1) value for each function call." She said okay. I used the Floyd algorithm. From the introduction to explaining the algorithm, about 20 minutes had
passed, and I was ready to write the code. Suddenly, she said, "If the number of nodes is 1 billion, you can't handle this..." I wanted to flip the table right then and there... Imagine knowing you'd been tricked but being unable to do anything about it 😂 I quickly came up with a BFS method and started coding. But you thought that was the end of it? During the coding session, the interviewer asked questions line by line!! -------- I won't say more, I'm tired. The interview was with Apple Services Engineering org, abbreviated as NB. Good luck to everyone! I'd also like to add that during my first round of interviews, I encountered more than five Indian men and women at the store, and only she challenged me. Everyone else
passed. Seeking advice and comfort.