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–25
Find the maximum total sum of two non-overlapping contiguous subarrays of given lengths firstLen and secondLen (either order allowed). Typical approach uses prefix sums or…
Companies: Meta, Sprinklr
Array · Dynamic Programming · Sliding Window
Last reported Oct 2026
Companies: OpenAI
Dynamic Programming
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 coin denominations available in unlimited quantity and a target amount, find the minimum number of coins needed to form that amount (return -1 if…
Companies: Amazon, Google, Pinterest, Uber
Array · Breadth-First Search · Complete Knapsack · Dynamic Programming
Last reported Oct 2026
Given an array of non-negative heights representing elevation bars of width 1, compute the total units of water that can be trapped between them after…
Companies: Amazon, Bloomberg, Goldman Sachs, Google +6
Array · Dynamic Programming · Monotonic Stack · Stack
Last reported Oct 2026
Given an array of daily stock prices, compute the maximum profit achievable from exactly one buy-before-sell transaction (i.e., the largest prices[j] - prices[i] with j…
Companies: Adobe, Amazon, Apple, Atlassian +10
Array · Dynamic Programming
Last reported Sep 2026
Determine whether the string s can be segmented into a sequence of one or more words from wordDict (words may be reused). The core challenge…
Companies: Amazon, Google, Grammarly, Meta +3
Array · Brute-Force Search · Dynamic Programming · Hash Table
Last reported Sep 2026
Given an array where nums[i] is the maximum forward jump from index i, compute the minimum number of jumps needed to reach the last index…
Companies: Amazon, Flipkart, Salesforce
Array · Dynamic Programming · Greedy
Last reported Sep 2026
Find the contiguous subarray within an integer array that yields the maximum possible sum and return that sum. This is typically solved in O(n) with…
Companies: Amazon, Google, LinkedIn, Meta +5
Array · Divide and Conquer · Dynamic Programming
Last reported Sep 2026
Count the number of contiguous substrings of s that are palindromes. With |s| up to 1000, the core challenge is to enumerate/detect all palindromic centers…
Companies: Goldman Sachs, Meta, Microsoft
Dynamic Programming · String · Two Pointers
Last reported Sep 2026
Given a string s and a word dictionary, return all possible sentences formed by inserting spaces so every token is a dictionary word — i.e.…
Companies: Bloomberg, Meta, ServiceNow
Array · Backtracking · Dynamic Programming · Hash Table
Last reported Aug 2026
Place the minimum number of cameras on nodes of a binary tree so every node is monitored by a camera on itself, its parent, or…
Companies: Amazon, D. E. Shaw
Binary Tree · Depth-First Search · DP on Trees · Dynamic Programming
Last reported Aug 2026
Given a string s, return the longest substring that reads the same forwards and backwards. The core challenge is efficiently finding palindromic spans around centers…
Companies: Adobe, Amazon, Bloomberg, Goldman Sachs +6
Dynamic Programming · Manacher · String · Two Pointers
Last reported Aug 2026
Given a set of weighted intervals, pick at most two non-overlapping events (events are inclusive, so the next must start at least end+1) to maximize…
Companies: Goldman Sachs, Grammarly
Array · Binary Search · Dynamic Programming · Heap (Priority Queue)
Last reported Jul 2026
Aggregate points for each distinct number (value * frequency), then choose a subset of values maximizing sum with the constraint that taking value x forbids…
Companies: Walmart, Walmart Labs
Array · Dynamic Programming · Hash Table
Last reported Jul 2026
Determine whether a string containing '(', ')', and '*' (where '*' can represent '(', ')', or empty) can be assigned so the parentheses are balanced…
Companies: Apple, Microsoft, Oracle
Bracket Sequences · Dynamic Programming · Greedy · Stack
Last reported Jul 2026
Given a list of intervals (endpoints touching allowed), find the minimum number to remove so the remaining intervals are pairwise non-overlapping — equivalently, select the…
Companies: Amazon, Docusign, Grammarly
Array · Dynamic Programming · Greedy · Sorting
Last reported Jul 2026
Given a binary string where every second all occurrences of "01" simultaneously become "10", determine how many seconds until no "01" remains; the core challenge…
Companies: Salesforce
Dynamic Programming · Simulation · String
Last reported Jun 2026
Choose a subset of non-overlapping jobs (jobs may touch at endpoints) to maximize total profit — the classical weighted interval scheduling problem. With up to…
Companies: Airbnb
Array · Binary Search · Dynamic Programming · Sorting
Last reported Jun 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
Find the maximum sum of any non-empty connected path in a binary tree (nodes used at most once), where the path can start and end…
Companies: Amazon, Datadog, DoorDash, Expedia +4
Binary Tree · Depth-First Search · DP on Trees · Dynamic Programming
Last reported Jun 2026
Companies: OpenAI
Dynamic Programming · Grids & Matrices
Last reported Jun 2026
Given a list of money transfers among people, compute the minimum number of transactions required to settle all debts so every person's net balance becomes…
Companies: Pinterest, Salesforce, Visa
Array · Backtracking · Bit Manipulation · Bitmask
Last reported Jun 2026
Given an array where each value is the maximum jump length from that index, determine whether you can reach the last index starting from the…
Companies: Amazon, Meta, Microsoft
Array · Dynamic Programming · Greedy
Last reported Jun 2026