Google·Software Engineer·Onsite - Coding / Algorithms
May 2026
Google SWE coding round, one graph problem that looked straightforward until the follow-ups started piling up. Spent most of the time on the counting logic rather than the traversal itself, which I didn't fully anticipate.
- Given an undirected graph and two nodes s and t, find the number of distinct shortest paths between them. Be ready to handle both unweighted and weighted edges.
- What are the time and space complexities for the BFS-based and Dijkstra-based versions of this shortest path counting problem?
- How does your solution handle edge cases like no path existing between s and t, or graphs with cycles?
“I got the BFS part down pretty fast, the real stumble was when they pushed toward weighted edges and Dijkstra.” The rest of the author's notes on Software Engineer interview at Google, Onsite - Coding / Algorithms round, covers how they worked through the question, what the panel pushed back on, and what they would do differently.
View Post