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–50
Design an online autocomplete system that processes characters one-by-one, returning the top 3 historically most frequent sentences that match the current prefix (ranked by…
Companies: Google, Netflix, Pinterest, Vercel
Data Stream · Depth-First Search · Design · Heap (Priority Queue)
Last reported May 2026
Maintain an evolving rooted family tree (king as root) that supports adding a child and marking a person dead, and return the current inheritance order…
Companies: Apple, Snowflake
Depth-First Search · Design · Hash Table · Tree
Last reported May 2026
Given a binary tree and the node x chosen by player 1, determine whether player 2 can pick a node y that guarantees victory by…
Companies: Anduril
Binary Tree · Depth-First Search · Tree
Last reported May 2026
Find all root-to-leaf paths in a binary tree whose node values sum to targetSum, returning each path as a list of values. This is solved…
Companies: Amazon, Meta, Microsoft, Salesforce
Backtracking · Binary Tree · Depth-First Search · Tree
Last reported May 2026
Given a directed, nonnegative-weighted graph and a start node k, compute single-source shortest-path distances and return the maximum distance (the time for the signal to…
Companies: CrowdStrike, NVIDIA
Breadth-First Search · Depth-First Search · Dijkstra's Algorithm · Graph Theory
Last reported Apr 2026
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
Return the boundary of a binary tree: list nodes on the left boundary top-down (excluding leaves), then all leaves left-to-right, then the right boundary bottom-up…
Companies: Amazon, Meta, Snowflake
Binary Tree · Depth-First Search · Tree
Last reported Feb 2026
For each node c in a weighted tree, count unordered pairs of distinct servers (a,b) (neither equal to c) such that the distances from c…
Companies: NVIDIA, Rippling
Array · Depth-First Search · Tree
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
Count the nodes in a binary tree whose value equals the integer average (floor of sum/count) of all values in their subtree — solved by…
Companies: Meta, Snowflake
Binary Tree · Depth-First Search · Tree
Last reported Aug 2025
Return the node values of a binary tree in inorder (left → root → right) sequence. The recursive solution is trivial; the follow-up asks for…
Companies: Anduril, Meta, Oracle
Binary Tree · Depth-First Search · Stack · Tree
Last reported Jul 2025
Return the k-th smallest value (1-indexed) in a BST — exploit that an in-order traversal yields values in sorted order and pick the k-th visited…
Companies: Amazon, Google, Meta, Uber
Binary Search Tree · Binary Tree · Depth-First Search · Tree
Last reported Mar 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
Check whether a binary tree is height-balanced, i.e., for every node the heights of its left and right subtrees differ by at most one. With…
Companies: Anduril
Binary Tree · Depth-First Search · Tree
Transform a BST so each node's value becomes its original value plus the sum of all keys greater than it; this is typically done with…
Companies: Apple
Binary Search Tree · Binary Tree · Depth-First Search · Tree
Return the preorder (root–left–right) traversal of a binary tree as a list of node values. The recursive solution is trivial; the follow-up asks for an…
Companies: Meta
Binary Tree · Depth-First Search · Stack · Tree
Count pairs of nodes in a rooted tree whose path edge-letters can be rearranged into a palindrome — equivalently, the multiset of letters on the…
Companies: Goldman Sachs
Bit Manipulation · Depth-First Search · Hash Table · Tree
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 acyclic directed graph of richer->poorer relations and a quietness score per person, compute for each person the quietest person among all people who…
Companies: Flipkart
Array · Depth-First Search · Directed Acyclic Graph · Graph Theory
Given a weighted tree, remove edges so that each node's degree in the remaining forest is at most k while maximizing the total weight of…
Companies: LinkedIn, Uber
Depth-First Search · Dynamic Programming · Sorting · Tree