DevsUnite

Google Interview Questions

59 real coding interview questions recently asked at Google, spanning Arrays and Strings, Trees and Graphs, Dynamic Programming, and 1 more topic, with a real difficulty tag and a direct LeetCode link for every question.

By DevsUnite · 59 Problems

Total Problems: 59Difficulty Levels:EasyMediumHard

Loading your progress…0/59
Two Sum
LeetCodeEasy

Given an array and a target, find the two indices whose values sum to the target, typically solved in a single pass using a hash map that stores each value's complement as it's seen. It requires no advanced technique, which is exactly the point — it's a fast, low-friction warm-up used to confirm a candidate can reach for a hash map instead of defaulting to a brute-force O(n^2) nested loop.

Longest Substring Without Repeating Characters
LeetCodeMedium

Find the length of the longest substring without repeating characters, the canonical sliding-window problem: maintain a window with two pointers and a hash map/set tracking the last-seen index of each character, jumping the left pointer forward whenever a repeat is found. It's one of the most fundamental sliding-window problems in interviewing and is often used to confirm a candidate can move beyond brute-force substring enumeration to a linear-time two-pointer approach.

Container With Most Water
LeetCodeMedium

Given an array of heights, find two lines that, together with the x-axis, form the container holding the most water. The optimal solution uses two pointers starting from both ends, always moving the pointer at the shorter line inward (since moving the taller one can never increase the area), tracking the best area seen. It tests two-pointer greedy reasoning and, more importantly, whether a candidate can articulate why the greedy move is provably safe rather than just applying it by rote.

3Sum
LeetCodeMedium

Find all unique triplets in an array that sum to zero. The standard approach sorts the array, then for each element uses a two-pointer sweep over the remaining elements, carefully skipping duplicate values to avoid repeated triplets in the output. It extends the simpler two-pointer/two-sum pattern into a triplet setting and tests whether a candidate can handle the deduplication logic correctly, which is where most candidates lose points.

Group Anagrams
LeetCodeMedium

Given a list of strings, group the ones that are anagrams of each other. The typical solution hashes each string to a canonical key (either its sorted characters or a fixed-length character-count signature) and groups strings sharing a key in a hash map. It's a straightforward but reliable test of whether a candidate reaches for the right canonicalization strategy and understands the tradeoffs between sorting-based and counting-based keys.

Product of Array Except Self
LeetCodeMedium

Compute, for each index, the product of all array elements except the one at that index, without using division. The standard O(1)-extra-space solution builds a running prefix product and running suffix product in two passes, multiplying them together for the final answer. It tests array manipulation and space-optimization thinking — specifically whether a candidate can avoid the naive division-based shortcut and still hit optimal time and space.

Merge Intervals
LeetCodeMedium

Given a collection of intervals, merge all overlapping ones. The standard approach sorts intervals by start time, then does a single linear pass, extending the current merged interval whenever the next one overlaps and starting a new one otherwise. It's a foundational interval problem that shows up across many companies because interval merging underlies a large family of harder scheduling and calendar-style questions.

Minimum Window Substring
LeetCodeHard

Find the smallest substring of a string s that contains every character of another string t (respecting character multiplicities). The solution is a variable-size sliding window with a hash map of required character counts and a counter tracking how many distinct required characters are currently satisfied, expanding the right pointer until the window is valid and then greedily shrinking from the left. It's a step up from basic sliding-window problems because of the 'expand until valid, then shrink while still valid' two-phase logic, which trips up candidates who haven't internalized the pattern.

Trapping Rain Water
LeetCodeHard

Given an elevation map, compute how much water it can trap after rain — the water trapped at each index equals the shorter of the tallest bars to its left and right, minus its own height. It's solvable with two pointers in O(1) extra space, with a monotonic stack, or with two precomputed max-prefix/max-suffix arrays, making it a great vehicle for comparing multiple valid techniques in one interview. Its breadth of companies asking it reflects that it's one of the most widely used checks of two-pointer/array reasoning in the entire interview circuit.

Find And Replace in String
LeetCodeMedium

Given a string and a list of (index, source, target) replacement operations, you must apply only the operations whose source substring actually matches at the given index, without letting earlier replacements shift the positions used by later ones. The clean approach is to sort or process operations by index and build the result in a single left-to-right pass, applying replacements only where they validate. It's mainly a simulation/indexing problem that tests careful, bug-free handling of string offsets under a specific ordering constraint rather than a named algorithm.

Maximum Points You Can Obtain from Cards
LeetCodeMedium

You must pick exactly k cards from either end of an array to maximize their sum. The standard trick is to reframe it as finding the minimum-sum contiguous window of size (n - k) in the middle of the array, then subtracting that from the total — turning a two-ended selection problem into a straightforward sliding window. It's a good test of whether a candidate can spot a non-obvious reformulation that reduces a seemingly two-pointer problem to a single fixed-size window.

Longest String Chain
LeetCodeMedium

Given a list of words, you need to find the longest chain where each word is formed by inserting exactly one letter into the previous word. It's solved with dynamic programming: sort words by length, and for each word try removing one character at a time to look up the best chain length ending at that shorter predecessor in a hash map. It tests whether a candidate can combine sorting, hashing, and a DP-over-strings formulation rather than brute-forcing all pairs.

Minimum Area Rectangle
LeetCodeMedium

Given a set of 2D points, find the minimum-area axis-aligned rectangle that can be formed using four of them as corners. The standard approach hashes points by column (or stores all points in a set) and checks pairs of points sharing the same x-coordinates as potential right-left edges, verifying the other two corners exist and tracking the minimum area. It's a solid signal for geometric reasoning combined with efficient hashing/lookups instead of a naive O(n^4) corner search.

Detect Squares
LeetCodeMedium

This is a design problem: you add points one at a time and must answer queries asking how many axis-aligned squares can be formed using a given point as one corner and three previously added points as the others. It's solved with a hash map counting occurrences of each point, then for a query, iterating over points sharing the query's x or y coordinate and checking whether the remaining two corners exist. It tests the ability to design an incremental data structure with fast add/count operations rather than recomputing from scratch on every query.

Number of Unequal Triplets in Array
LeetCodeEasy

You need to count triplets of indices i < j < k such that nums[i], nums[j], and nums[k] are all pairwise distinct values. A hash map counting frequency of each value lets you compute the count combinatorially (for each distinct value, multiply how many valid choices exist before/at/after it) instead of the brute-force O(n^3) triple loop. It's a lighter, easy-tier problem mainly testing comfort with frequency counting and combinatorics.

Pour Water
LeetCodeMedium

A terrain-simulation problem: water droplets are poured one at a time onto an array representing heights, and each droplet flows left or right toward the lowest reachable point before settling (with left preferred as a tiebreak). It requires careful, step-by-step array simulation rather than a shortcut formula, and Google/Airbnb use it as a check of whether a candidate can correctly implement a stateful physical process with several interacting edge cases (flat ground, walls, no valid drop point).

Best Meeting Point
LeetCodeHard

Given a grid where 1s mark people's houses, find the point that minimizes the total Manhattan distance everyone has to travel to meet there. The key insight is that Manhattan distance is separable into independent x and y components, and the point minimizing total distance along each axis is the median of that axis's coordinates — so you sort the row and column indices separately and sum distances to their medians. It's a strong signal for whether a candidate recognizes when a 2D optimization decomposes into two independent 1D median problems.

Decode String
LeetCodeMedium

A stack-based string-processing problem: decode a nested, run-length-encoded string like "3[a2[c]]" into its expanded form, where the nesting can go arbitrarily deep. The standard approach pushes the current string and repeat count onto a stack whenever a '[' is seen and pops/multiplies/concatenates on ']'. It's a clean test of stack-based parsing and correctly handling nested state, which is exactly why it's used across companies as a string-processing check.

H-Index
LeetCodeMedium

Given a researcher's citation counts, compute their h-index — the largest h such that at least h papers have at least h citations each. It tests whether a candidate can sort the array (or use counting sort for a linear-time variant) and reason precisely about the threshold condition, including edge cases where no papers or all papers qualify. It's a good signal for translating a somewhat abstract, real-world-sounding metric definition into a precise algorithmic condition.

Amount of New Area Painted Each Day
LeetCodeHard

Each day you paint an interval on a number line, and you need to report how much of that day's interval was newly painted (i.e., not already painted by a previous day). It's typically solved with a Union-Find structure where each position points to the next unpainted position, letting you "jump over" already-painted ranges in near-constant amortized time instead of re-scanning them, or alternatively with a segment tree tracking the maximum unpainted position in a range. It's a hard interval-processing problem that tests whether a candidate can apply Union-Find outside its typical connectivity use case.

Log in to save your progress, favorites, and notes to your account.

Frequently asked questions

What coding interview questions does Google ask?

This page tracks 59 real, recently reported Google coding interview questions, organized by topic: Arrays and Strings, Trees and Graphs, Dynamic Programming, and 1 more topic.

How many Google interview questions are on this list?

59 questions in total: 4 Easy, 39 Medium, and 16 Hard, each linked to its real LeetCode problem page.

Is it free to use?

Yes. Browsing every problem on this page is completely free, with no account required. Creating a free DevsUnite account lets you save your checked-off progress, star favorites, and add personal notes that sync across devices.

Do I need an account to track my progress?

You can read and solve every problem without logging in. An account is only required to mark a problem as done, star it, or add a note. Those actions save to your account instead of resetting on refresh.