Destination City
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a list of one-way flights paths, where paths[i] = [from, to] means there is a direct route from city from to city to. Taken together, the routes form a single chain with no loops, so exactly one city has no outgoing route.
Return the name of that final city (the one that never appears as a departure).
Examples
Constraints
- 1 <= paths.length <= 100
- paths[i].length == 2
- 1 <= length of each city name <= 10
- from != to for every route
- The routes form one simple chain, so the answer is unique
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.