Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 26–41
Given lists where each entry names a parent region followed by its immediate subregions and two region names, find their smallest common region — the…
Companies: Airbnb
Array · Binary Lifting · Breadth-First Search · Depth-First Search
Last reported Apr 2026
Given an n×n binary grid where you can flip at most one 0 to 1, compute the largest possible 4-directional island size after the flip…
Companies: DoorDash, Meta, TikTok, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Mar 2026
Design algorithms to serialize an N-ary tree into a single string and deserialize it back, preserving node values and the arbitrary number and order of…
Companies: Apple, Bloomberg, Rubrik, TikTok
Breadth-First Search · Depth-First Search · String · Tree
Last reported Mar 2026
Given a binary tree and a target node value, return all node values at distance K from the target. The challenge is to traverse both…
Companies: Amazon, Meta, Microsoft, TikTok
Binary Tree · Breadth-First Search · Depth-First Search · Hash Table
Last reported Mar 2026
Given an n×n binary grid where 0s are open and 1s are blocked, return the length (number of cells) of the shortest 8-directionally connected path…
Companies: Amazon, Anduril, Meta
Array · Breadth-First Search · Matrix
Last reported Dec 2025
Given n people and pairwise dislikes, determine whether the corresponding undirected graph is bipartite — i.e., whether you can 2-color all vertices (split into two…
Companies: LinkedIn, TikTok, Uber
Bipartite Graph · Breadth-First Search · Depth-First Search · Graph Coloring
Last reported Dec 2025
Given a binary tree and a start node, compute how many minutes it takes for an infection that spreads each minute to adjacent nodes (parent/children)…
Companies: Microsoft, Salesforce
Binary Tree · Breadth-First Search · Depth-First Search · Hash Table
Last reported Dec 2025
Compute each cell's Manhattan distance to the nearest thief, then find a path from (0,0) to (n-1,n-1) that maximizes the minimum of those distances along…
Companies: Google, Meta, Uber
Array · Binary Search · Breadth-First Search · Heap (Priority Queue)
Last reported May 2025
Given a string containing letters and parentheses, remove the minimum number of parentheses to produce all distinct valid parentheses strings and return them. The core…
Companies: Meta
Backtracking · Breadth-First Search · String
Last reported May 2025
Simulate days on an m×n grid where infected cells spread 4-directionally: each day identify all connected infected regions, compute for each the set of uninfected…
Companies: Flipkart, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Jan 2025
Given a string and allowed index swap pairs, view pairs as edges in a graph to find connected components where characters can be freely permuted…
Companies: Goldman Sachs, Google
Array · Breadth-First Search · Depth-First Search · Hash Table
Last reported Oct 2024
Given a string with brace-enclosed comma-separated option groups and implicit concatenation (e.g., "{a,b}c{d,e}"), generate all unique strings formed by choosing one option…
Companies: Anduril
Backtracking · Breadth-First Search · Sorting · Stack
Given an undirected graph, return for every vertex the shortest distance to the nearest vertex that lies on any cycle. Key idea: identify cycle vertices…
Companies: Salesforce
Breadth-First Search · Depth-First Search · Graph Theory · Topological Sort
Given an undirected graph and a set of initially infected nodes, choose one initial node to remove so that the eventual malware spread across connected…
Companies: Zomato
Array · Breadth-First Search · Depth-First Search · Graph Theory
Treat the boustrophedon-labeled board as a 1D graph of squares where from any square you can move 1–6 steps (dice roll), but landing on a…
Companies: Tesla
Array · Breadth-First Search · Matrix
Find all integers in a given inclusive range whose adjacent digits differ by exactly 1 (stepping numbers), including single-digit and zero cases. Because the range…
Companies: eBay
Backtracking · Breadth-First Search · Math