&gt; they want to know that you have the basic mental dexterity to figure things like this out<p>If you have the &quot;mental dexterity&quot; to coming up with your own solution which is identical to Dijkstra&#x27;s pathfinding algorithms in terms of complexity within an hour interview, you are a god among mortals.<p>And that&#x27;s what they expect - a solution to a problem that is equal to the best minds of our field. I say this from experience: I was expected to do exactly that, and criticized when I came up with a O(n^3) instead of O(n^2).