At first it was the usual back-and-forth introductions.
The code was written on HackerRank, and the moment I heard the question I broke out in a sweat — since when does a frontend interview ask a graph question?
Simply put, it was a flight ticket problem. Input: number of cities, [[departure city number, arrival city number, ticket price]...], and the maximum number of stops. Output: the lowest total ticket price.
I hadn't touched graph problems in years and hadn't practiced them specifically, so all I could do was fall back on backtracking. I got a version working that ignored the max-stops condition — adding that condition back wouldn't have been hard, just checking in the backtracking whether the stop count was exceeded and returning infinity if so — but I ran out of time.
On top of that, the interviewer wasn't very familiar with how to run the input/output, so we just used console.log and tested two cases, both of which came out correct.
It was also pretty ridiculous that the interviewer didn't know TypeScript — kind of a mismatch for the position being interviewed for.
Discussion
Loading comments…