Google·Software Engineer·Onsite - Coding / Algorithms
Jun 2026
Three algorithmic problems back to back at Google for a software engineer role. Each one had a naive solution they wanted you to name first and then an optimized version, which sounds straightforward but the pressure of doing complexity analysis out loud while coding is its own skill.
- Given a log of chat messages where each entry is a user ID, find the top K most active users by message count. Discuss at least two approaches and their time and space complexities.
- Count the number of distinct paths in an m by n grid from the bottom-left cell to the bottom-right cell, where from any cell you can only move to the next column either straight right, diagonally up-right, or diagonally down-right. First give an O(m*n) DP solution, then optimize space to O(m).
- Given a list of car rental bookings each with a pickup and return time, compute the minimum number of cars needed and produce a valid assignment of rentals to cars. Discuss a naive approach and an optimized one using a priority queue.
“Started with the sort-everything approach which is O(n log n) and they nodded but clearly wanted the heap version.” 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