Google DS & Algo Interview Questions 2026
Google has one of the toughest DS & Algo rounds in the industry. DSA rounds are there for both frontend and backend roles.
Google's interview codebase is very large, with questions of all difficulty levels from super easy to super hard. One question can be a medium question with a couple of follow-ups for optimizations, or it can be just one hard question. It all depends on which question the interviewer chooses.
There are two common things about candidates who clear Google interviews and whose overall process is smooth.
- At least 2 "Strong-Hire" votes and no "No-Hire" in the on-site packet.
- Candidates who narrated trade-offs and edge cases, and correctly answered counter questions, got bumped from "Hire" to "Strong Hire" even with small bugs.
Now above points have lots of exceptions. For example one person bombed one coding round badly.
But they were given a redo by their recruiter. It was late 2024 and he was working long hours, spending even the weekends on call. Still he was laid off alongside other teammates.
Lay off was a blow to his morale. He didn't tell even his parents, just pretended he was working from home. Avoided video calls during "work hours". Initially he spent the days watching anime. But slowly preparation started and when the Google call came, he has already been rejected by multiple companies.
He thought it was all over after he messed up one DSA round. But he was able to do well in the redo round and finally ended up receiving the offer.
Few Helpful links
- All Google Questions https://codezym.com/lld/google
- Amazon DS & Algo Questions https://codezym.com/lld/amazon-dsa
- Amazon Low Level Design Questions https://codezym.com/lld/amazon
Judging how the interview went
Many a times you may not be able to guess correctly , how well or how bad you did. There are tons of experiences where candidate thought something and the opposite happend. A lot of things can go right or wrong. One person had done 400+ leetcode problems but during interviews, panic setup and they were able to only come up with a brute force solution.
Another person had two back to back coding rounds scheduled at a gap of just 15 minutes. And during the first round they realised that solution they provided is incorrect. They thought that they had bombed this round and should just cancel the next round. But interviewer provided some guidance and they were able to solve slightly easier version of the problem. However other rounds went well and they ended up receiving the offer.
What if you are rejected
Even if you are rejected its not the end of world. Google recruiters will almost certainly reach out to you a year later. Just keep preparing. One person was rejected by google for L4 position in 2024. But they reapplied 6 months later and surprisingly got a response. However their first two coding rounds got lean hire. Still recruiter decided to go through with other rounds which wents well. During hiring committee their prospects were weak because of two lean hires in coding. However another DSA round was scheduled for them in which they did well.
They ended up receiving offer for L5. That's like getting a promotion within one year. Although they were lowballed but still it was a 20% raise from their current salary. So overall not a bad end.
I created this list from people posting their experiences on forums, blogs, etc.
Below are the questions which you can directly find on LeetCode.
LeetCode Questions
Sum of Distances in Tree
https://leetcode.com/problems/sum-of-distances-in-tree/description/Lowest Common Ancestor of a Binary Tree
https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/description/CodeZym practice questions
The summaries below were prepared from the actual CodeZym problem statements. Each question is presented in its own row so the list remains comfortable to scan.
Minimum Time to Reach All Targets
Signals spread simultaneously from every source through a city grid while blockers stop propagation. Return the earliest time when every target is reached, or -1 if any target is unreachable.
https://codezym.com/question/406-min-time-to-reach-all-targetsRestore Astronaut Transmission
Decode an astronaut transmission in which repeated sections use count[section] notation and may be nested. Restore and return the complete transmission.
https://codezym.com/question/420-restore-astronaut-transmissionHelp Article Suggestions
Group transitively related help articles, then suggest up to k other articles from the opened article’s group. Rank suggestions by helpfulness score, breaking ties by smaller article ID.
https://codezym.com/question/407-help-article-suggestionsGroup Buddy Strings
Group equal-length strings whose consecutive characters have the same cyclic-distance pattern. Preserve duplicates, input order within groups, and the order in which groups first appear.
https://codezym.com/question/408-group-buddy-stringsShortest Word Tile Group
In a word game, lowercase letter tiles are arranged in a row. You want to take one continuous group of tiles and use its letters to form a given word. Find the shortest continuous group containing enough letters to form the word after rearranging them.
https://codezym.com/question/417-min-piano-hand-liftsAdvertisement Score Delay
Build an advertisement server that returns the highest-scoring eligible ad. After serving an ad, reduce its score by one and prevent it from appearing in two consecutive requests.
https://codezym.com/question/409-advertisement-score-delayRoute Handler Matching
Store parameterized route patterns and match incoming URLs. Prefer the match with more static segments, then the route registered earlier.
https://codezym.com/question/410-route-handler-matchingAlternating Color Binary Tree Nodes
Find every node that can root the graph as a binary tree whose levels alternate between black and white. The follow-up asks for the minimum recolorings needed to make at least one root valid.
https://codezym.com/question/411-alternating-color-binary-tree-nodesLongest Repeated Activity Pattern
A factory machine records its activities using lowercase letters from 'a' to 'z'. Each letter represents one activity. For example, 'a' may mean idle, 'b' may mean loading material, 'c' may mean processing, and 'd' may mean inspecting the finished product. Find the longest continuous activity pattern that appears at least twice in the machine's activity log.
https://codezym.com/question/419-longest-repeated-activity-patternSubset Sum Equal to K
Given a list of integers nums and an integer k, determine whether any subset of the list has a sum equal to k. Each element may be selected at most once. A subset does not need to contain consecutive elements. The empty subset is allowed and has a sum of 0.
https://codezym.com/question/305-subset-sum-equal-to-kMaximum Weekend Market Earnings
Choose which markets remain open in a tree of villages. Each open market reduces the earnings of neighboring open markets, so maximize the final total earned by all open markets.
https://codezym.com/question/412-max-weekend-market-earningsMinimum Suspension Strength
A warehouse robot moves across a rectangular floor divided into tiles. Each tile has a surface resistance value. The strain caused by moving between two neighboring tiles is the absolute difference between their resistance values. The suspension strength needed for a route is the largest strain produced by any move on that route.
https://codezym.com/question/421-minimum-suspension-strengthLongest Learning Progression
A learning app stores the difficulty level of each lesson completed by a student. The lesson levels appear in chronological order. For the main task, the student wants to build a step-by-step learning progression. Each selected lesson after the first must be exactly one level harder than the previous selected lesson. Return the length of the longest learning progression.
https://codezym.com/question/413-longest-learning-progressionPeriodic Table Word Ways
You are given a list of chemical element symbols and a word. Count the number of different ways to form the entire word by joining symbols from the list. Symbols may be reused, and matching is case-insensitive. Each character of the word must belong to exactly one selected symbol.
https://codezym.com/question/414-periodic-table-word-waysChess Players Rank
There are n chess players numbered from 0 to n - 1. You are given the results of some games. Each result is represented by the string "u,v", meaning player u defeated player v. A smaller numerical rank represents a stronger player, and the stronger player always wins. Use the known results and their transitive relationships to determine which players have an exact rank.
https://codezym.com/question/415-chess-players-rankMinimum Piano Hand Lifts
You are given a sequence of piano notes and a maximum hand span k. Each note is represented by its integer position on the keyboard. During one hand placement, the difference between the leftmost and rightmost playable keys cannot exceed k. If the next note cannot be reached from the current placement, the hand must be lifted and positioned again.
https://codezym.com/question/416-min-piano-hand-liftsTotal Number of Ways to Decode a Message
A message containing letters from A to Z is represented using numbers from 1 to 26. Given a digit string s, return the total number of valid ways to decode the entire string. Encoding A -> 1 B -> 2 ... Z -> 26 Every digit must belong to a valid one-digit or two-digit encoding. A segment cannot begin with 0, so values such as "0", "06", and "30" cannot be decoded as individual letters.
https://codezym.com/question/309-number-of-ways-to-decode-messageCount String Prefixes on Tree Paths
For every prefix of s, find how many times that prefix appears in the tree. A prefix appears in the tree if you can choose an ordered simple path of nodes such that the sequence of letters on that path is exactly equal to that prefix.
https://codezym.com/question/137-string-prefix-on-tree-pathsMost Used Airport Rest Pod
Assign airport reservations to the smallest available rest-pod number, delaying reservations when every pod is occupied. Return the pod that handled the most reservations.
https://codezym.com/question/418-most-used-airport-rest-podValid Course Order with Prerequisites
There are numCourses courses labeled from 0 to numCourses - 1. Some courses must be completed before other courses can be taken. Each prerequisite is represented by a string "course,prerequisite". It means that prerequisite must be completed before course. Return an order in which all courses can be completed.
https://codezym.com/question/336-valid-course-orderDetect First Timed Out Job from Logs
Each log entry contains: a job id a timestamp an event type: START or END You are also given an integer timeoutThreshold. A job starts when its START log appears and finishes when its matching END log appears. Return the id of the first job that is detected to have timed out.
https://codezym.com/question/138-detect-first-timed-out-job-logsCan All Factory Machines Start
A factory has several machines that need to be started. Some machines can start only after specific other machines are already running. Determine whether every machine can be started while satisfying all startup requirements.
https://codezym.com/question/422-can-all-factory-machines-startCount Visible People in Queue with Taller Observer Rule
A person may look both to the left and to the right. Person i can see person j if i != j and every person standing strictly between them is shorter than at least one of the two endpoint people. Return a list answer of length n where answer[i] is the number of people person i can see in the queue.
https://codezym.com/question/139-count-visible-people-queue-tallerMaximum Sum Subarray with Equal First and Last Elements
Return the maximum sum of a non-empty contiguous subarray whose first and last elements are equal. A one-element subarray is valid.
https://codezym.com/question/140-maximum-sum-subarray-equal-first-last-elementsDesign a rate limiter
Implement an extensible rate limiter supporting fixed-window and sliding-window counter strategies, each with its own request-counting behavior.
https://codezym.com/question/34-design-rate-limiterMaximum Score from Non-Adjacent Tiles
A game contains tiles with non-negative scores. A player may select tiles to collect their scores, but two neighboring tiles cannot both be selected. Determine the maximum score the player can collect when the tiles are arranged in a straight line and when they are arranged in a circle. Rules Each tile may be selected at most once. Two neighboring tiles cannot both be selected.
https://codezym.com/question/372-max-score-from-non-adjacent-tilesMinimum Strokes to Paint Fence
Paint a fence using one-meter vertical or horizontal brush strokes. Calculate the minimum number of strokes required to cover every plank completely.
https://codezym.com/question/207-minimum-strokes-to-paint-fenceLongest Constrained Path in Matrix
The grid is provided as a list of strings, where each string represents one row and the values in that row are separated by commas. Find the length of the longest valid path in the grid.
https://codezym.com/question/141-longest-constrained-path-matrixRepeated Characters in Dictionary Words Due To Faulty Keyboard
You are given the final typed string and a dictionary of valid words. Return all possible words the user intended to type.
https://codezym.com/question/142-repeated-characters-dictionary-words-faulty-keyboardDetect Squares Rotated along the XY Plane
Design a data structure that supports adding points from the stream and counting how many squares can be formed with a given query point. Unlike the simpler axis-aligned version, the square may be rotated at any angle on the plane.
https://codezym.com/question/143-detect-squares-rotated-xy-planeSum of All Good Arithmetic Sequences
A good arithmetic sequence is an arithmetic sequence whose common difference is either 1 or -1. For example, [4, 5, 6] is a good arithmetic sequence, and any sequence that has only one element is also a good arithmetic sequence. You are given a list of integers nums. Return the sum of the sums of all contiguous subarrays that are good arithmetic sequences.
https://codezym.com/question/144-sum-good-arithmetic-sequencesCompile Packages with Dependencies in a Multi-Threaded Environment
Compile packages in dependency order using at most a configurable number of worker threads per round. Use lexicographical tie-breaking and return an empty list when the graph contains a cycle.
https://codezym.com/question/145-compile-packages-dependenciesEqual Sum Subsets with K Changes
Determine whether all values can be divided into two non-empty subsets with equal sums. The follow-up permits changing at most k values by exactly one before partitioning.
https://codezym.com/question/146-equal-sum-subsets-k-changesUndirected Graph Path Queries
Consider an undirected graph where each node corresponds to one index of arr. Add an edge between nodes i and j if |arr[i] - arr[j]| ≤ diff. You are also given a list of queries queries, where each query is a comma-separated string "u,v". For each query, return whether there is a path between node u and node v.
https://codezym.com/question/147-undirected-graph-path-queriesArray Range Update Queries
Each query updates all elements from index l to index r to value k. Return the final state of the array after processing all queries in order.
https://codezym.com/question/148-array-range-update-queriesRouter Reachability on Broadcast and Shutdown Message
Working routers broadcast a shutdown message to other working routers within range, then shut down. Determine whether the message initiated at the source eventually reaches the destination.
https://codezym.com/question/149-router-reachability-broadcast-shutdown-messageFirst Bad Product Version
Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad. You are given an API boolean isBadVersion(int version) which returns whether a version is bad. Implement a function to find the first bad version. You should minimize the number of calls to the API. Method Signatures
https://codezym.com/question/150-first-bad-product-versionDesign Logger Message Printer
Process chronologically ordered log messages and allow each unique message to print at most once during any ten-second window.
https://codezym.com/question/151-design-logger-message-printerLongest Path in Grid
We can enter the grid from any empty cell in the first row and exit the grid from any empty cell in the last row. We can move left, right, up, and down. We can only travel through empty cells. Find the longest path we can travel.
https://codezym.com/question/152-longest-path-gridMerge Working Hour Intervals Timeline
Split working schedules into the smallest non-overlapping intervals whose active-person set stays constant. Merge consecutive intervals containing the same people.
https://codezym.com/question/153-merge-working-hour-intervals-timelineDays When Everyone is Free
Each record represents one blocked interval for one person. Each record is given as a string in the format "id,start,end". Return all days between 1 and d on which every person is free. This list will be sorted in ascending order.
https://codezym.com/question/154-days-when-everyone-is-freeSize of Unpainted Segments
Each interval represents a segment on the number line in the form [start, end). We paint the intervals one by one in the given order. For each interval, return the size of the part that has not already been painted by any previous interval.
https://codezym.com/question/155-size-of-unpainted-segmentsOverall Distance Error Between Checkpoints and Samples
The first stream contains a small set of ground truth checkpoints. The second stream contains noisy measured samples. For each sample, compute its error by: locating the surrounding checkpoints in time, interpolating the expected position at that timestamp, computing the distance error between the expected position and the sample position.
https://codezym.com/question/156-distance-error-checkpoints-samplesMinimum CPUs Needed for Earliest Tasks Completion
Each task has the same length taskLength. A task may start at its given start time or at any later time. Find the minimum number of CPUs needed so that all tasks finish as early as possible.
https://codezym.com/question/157-cpus-needed-earliest-tasks-completionTotal Scores of Leaf Domains
A domain is a leaf if it does not have any child domains in the input. A leaf domain's total score is the sum of: its own score, and the scores of all of its ancestor domains that are present in the input. Write a program that, given the input list, returns all leaf domains with their respective total scores.
https://codezym.com/question/158-total-scores-leaf-domainsPlace Nth Rook
There are already N - 1 rooks placed on the board. These rooks do not attack each other. More formally: no row contains more than one rook no column contains more than one rook You need to place the Nth rook and return the position (i, j) where it should be placed.
https://codezym.com/question/159-place-nth-rookFind Most Active Users in Chat Logs
Register chat events and measure each user by the number of distinct people they have contacted. Return the most active user or the top k users at the current time.
https://codezym.com/question/160-most-active-users-chat-logsDesign BookShelf Manager with Bookmark Functionality
Maintain an ordered bookshelf with insertion, deletion and range moves. A bookmark must continue pointing to the exact same book occurrence until that book is removed.
https://codezym.com/question/161-design-bookshelf-manager-bookmark-functionalityRun Length Encoding for List of Characters
Run-length encode consecutive characters and also support looking up a character at a requested index in the original sequence from a compressed representation.
https://codezym.com/question/162-run-length-encoding-list-charactersRouter Broadcast and Shutdown Message With Collisions
Routers rebroadcast a message and then shut down. Determine whether the destination receives exactly one earliest message; simultaneous earliest arrivals collide and are discarded.
https://codezym.com/question/163-router-broadcast-shutdown-message-collisionsThanks for reading
Wish you the best of luck with your Google interview preparation.