I didn’t reproduce it from memory though (but I did choose to port a Java version in preference to any of the existing Python versions I found, because it’s code was structured in a way that I grokked much easier. Possibly due to my not totally expert idiomatic Python skills, I’m really a Perl coder deep down.)
(And I never had to do any whiteboard performative coding to land this gig either.)
Totally wouldn't work for Google Maps doing shortest path routing globally, but for an event with only a couple of hundred POIs and intersections, it's a cheat that seems almost magical to people who have some concept of the algorithmic problem, but haven't worked out the "trick".
If I were asked to whiteboard this, I would 100% be asking that constraints of the dataset up front. (I'm not too sure I'd have been smart enough to do that a couple of decades back, when I last had a "perform for us code-monkey!" type of job interview...)
And when is the last time you had to balance a binary tree or write Djikstra’s algorithm from memory anyways?