Google Coding Interview Questions
26 Google coding interview problems with full optimal solutions — 2 easy, 13 medium, 11 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Google interviewer values, and a FAQ section.
Showing 9 problems of 26
- #23hardfrequently asked
23. Merge k Sorted Lists
Given k sorted linked lists, merge them into one sorted linked list. Google asks this to see whether you reach for a min-heap, can articulate the n log k vs nk tradeoff, and know how to compare two linked-list nodes inside a priority queue.
- #42hardfrequently asked
42. Trapping Rain Water
Given heights, compute how much water trapped between bars after rain. Google asks this to see whether you reach for the two-pointer invariant (water at i depends only on min(maxLeft, maxRight)) without falling into the O(n^2) trap of recomputing maxes per index.
- #68hardfrequently asked
68. Text Justification
Given an array of words and a max line width, format the text so each line is fully justified. Google asks this to see whether you can manage the edge cases (last line, single-word lines, uneven space distribution) without losing track.
- #72hardfrequently asked
72. Edit Distance
Given two strings, return the minimum number of insertions, deletions, and substitutions to transform one into the other. Google asks this to test whether you can set up a 2D DP recurrence cleanly and articulate why each character pair has exactly four sub-choices.
- #124hardfrequently asked
124. Binary Tree Maximum Path Sum
Find the maximum sum path in a binary tree, where the path can start and end at any node. Google asks this to test whether you can separate two concepts at the same recursive node: the best path that 'extends upward' versus the best path that 'turns at this node and goes nowhere else.'
- #127hardfrequently asked
127. Word Ladder
Given a begin word, end word, and word list, return the length of the shortest transformation sequence where each step changes one letter. Google asks this to test whether you reach for BFS on an implicit graph and can articulate why BFS (not DFS) is the right tool for shortest-path on unweighted edges.
- #212hardfrequently asked
212. Word Search II
Given a 2D board and a list of words, return all words on the board. Google asks this to test whether you reach for a trie + DFS combo and can articulate why it's drastically faster than running Word Search I once per word.
- #295hardfrequently asked
295. Find Median from Data Stream
Maintain the median of a stream of numbers with O(log n) addNum and O(1) findMedian. Google asks this to test whether you reach for two heaps (max-heap of lower half + min-heap of upper half) and can articulate the size-balance invariant.
- #297hardfrequently asked
297. Serialize and Deserialize Binary Tree
Encode a binary tree to a string and decode it back. Google asks this to test whether you handle null markers correctly and choose a traversal order that both serialize and deserialize can agree on without ambiguity.
Related interview-prep guides
HireVue Tech Interview Guide: The 2026 Playbook for Async Video Rounds
HireVue is the category-leading async video interview platform. Candidates record answers solo, on the clock, and a combined AI-plus-human review layer scores the recording days later. For 2026 tech jobseekers, the format is different enough from live interviews to need its own playbook. This guide is that playbook.
HackerRank Tech Interview Guide 2026: What It Tests, How It Tracks You, and the Modern Setup
HackerRank is still the volume leader in first-round technical screens for 2026 tech hiring. A browser-sandboxed coding environment that logs every keystroke, paste event, and tab-focus change inside its own tab. This guide covers what it tests, the boundary of what it can and cannot detect, and how a modern desktop setup pairs with a HackerRank session without leaking into the screen-share.
Karat Technical Interview Guide 2026: How the Third-Party Loop Actually Works
Karat is technical-interview-as-a-service. Karat-employed engineers run the technical loop for the hiring company in Karat's own recorded video and coding environment. The dynamic is different from an in-house interview: the interviewer is a contractor, not a future teammate, the rubric is fixed, the session is recorded for asynchronous review, and the hiring team's engineers watch the playback a day later. This guide is the practical map of how that loop works in 2026 and how a modern desktop setup runs alongside it.