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 1–20
Given numCourses and prerequisite pairs, return any ordering of courses that satisfies all prerequisites or an empty array if impossible — this is essentially computing…
Companies: Amazon, Anduril, Apple, Citadel +11
Breadth-First Search · Depth-First Search · Graph Theory · Topological Sort
Last reported Nov 2026
Given a list of directed flight tickets, reconstruct an itinerary starting at "JFK" that uses every ticket exactly once and, among all valid itineraries, returns…
Companies: Amazon, Anduril, Google, Pinterest
Array · Depth-First Search · Eulerian Circuit · Eulerian Path
Last reported Nov 2026
Given a functional directed graph (each node has at most one outgoing edge), return the length of the longest directed cycle or -1 if no…
Companies: Anduril
Breadth-First Search · Depth-First Search · Graph Theory · Kosaraju's Algorithm
Last reported Oct 2026
Given a DAG of course prerequisites where each course has a duration and any number of courses can run in parallel once prerequisites are satisfied…
Companies: Google, Meta, Modular, Salesforce +1
Array · Directed Acyclic Graph · Dynamic Programming · Graph Theory
Last reported Oct 2026
Find the minimum-cost route from src to dst in a directed weighted graph with the constraint of at most k stops (i.e., a bound on…
Companies: Flipkart, Illumio, Meta, Oracle +1
Breadth-First Search · Depth-First Search · Dynamic Programming · Graph Theory
Last reported Oct 2026
Given courses as nodes and prerequisite pairs as directed edges, determine whether the directed graph is acyclic — return true if a topological ordering exists…
Companies: Amazon, Anduril, Cloudflare, DoorDash +6
Breadth-First Search · Depth-First Search · Directed Acyclic Graph · Graph Theory
Last reported Oct 2026
Starting from given initial boxes, repeatedly open any box that is either already open or for which you have a key to collect its candies…
Companies: Airbnb
Array · Breadth-First Search · Graph Theory
Last reported Sep 2026
Design a spreadsheet supporting set/get and sum operations where sum formulas can reference individual cells and rectangular ranges; the core challenge is maintaining a…
Companies: Airbnb, Discord
Array · Design · Graph Theory · Hash Table
Last reported Sep 2026
Given pairwise variable ratios, build a weighted graph (or use union-find with multiplicative weights) where edges represent divisions, and answer each query by finding a…
Companies: Amazon, Bloomberg
Array · Bellman–Ford Algorithm · Breadth-First Search · Depth-First Search
Last reported Sep 2026
Given a sorted list of words in an unknown alphabet, infer the relative ordering of characters by deriving precedence constraints between first differing letters, then…
Companies: Amazon, Bloomberg, Google, Intuit +3
Array · Breadth-First Search · Depth-First Search · Directed Acyclic Graph
Last reported Aug 2026
Given an n x n symmetric adjacency matrix where isConnected[i][j]=1 denotes a direct undirected edge between cities, count the number of connected components (provinces) formed…
Companies: Amazon, Coupang, Uber
Breadth-First Search · Depth-First Search · Graph Theory · Union-Find
Last reported Aug 2026
Given a directed graph whose underlying undirected graph is a tree, compute for every node the minimum number of edge reversals required so that starting…
Companies: Microsoft, Salesforce, Uber
Breadth-First Search · Depth-First Search · Dynamic Programming · Graph Theory
Last reported Jun 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 recipes whose ingredients may include other recipes and an initial set of supplies, determine which recipes can be produced; the core challenge is dependency…
Companies: Amazon, Google, Tesla
Array · Directed Acyclic Graph · Graph Theory · Hash Table
Last reported Feb 2026
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
Find the maximum sum of unique node values collectible by any walk that starts and ends at node 0 within a given time budget on…
Companies: Amazon, Nutanix
Array · Backtracking · Graph Theory
Last reported Nov 2024
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 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
Given a directed acyclic graph, find the smallest set of starting vertices from which every node is reachable. In a DAG this is uniquely achieved…
Companies: Anduril
Directed Acyclic Graph · Graph Theory