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
Given a digit string, count how many ways it can be segmented into valid codes 1–26 (two-digit codes cannot start with '0'), handling invalid zeros…
Companies: Anduril, Lyft, Meta
Dynamic Programming · String
Last reported May 2026
Given a number n, generate all distinct well-formed parentheses strings formed from n pairs of opening and closing brackets. Return all valid combinations as a…
Companies: Amazon, Bloomberg, Microsoft, Salesforce
Backtracking · Bracket Sequences · Dynamic Programming · String
Last reported Apr 2026
Find the length of the longest well-formed (balanced) parentheses substring in a string of '(' and ')', handling nested and adjacent valid segments; this typically…
Companies: Amazon, Meta, Microsoft, Uber
Bracket Sequences · Dynamic Programming · Stack · String
Last reported Apr 2026
Companies: OpenAI
Dynamic Programming · Simulation & State Machines
Last reported Apr 2026
Given daily stock prices, compute the maximum profit you can achieve with unlimited buy/sell operations while holding at most one share at a time (you…
Companies: Apple, Bloomberg, Meta, Oracle
Array · Dynamic Programming · Greedy
Last reported Mar 2026
Given an m×n grid of non-negative numbers, find the minimum-sum path from the top-left to bottom-right when you may only move right or down. This…
Companies: Goldman Sachs, Oracle
Array · Dynamic Programming · Matrix
Last reported Mar 2026
Split the array into k non-empty contiguous subarrays so that the maximum subarray sum is as small as possible, and return that minimized largest sum…
Companies: Amazon, Google, Microsoft, Pinterest +2
Array · Binary Search · Dynamic Programming · Greedy
Last reported Feb 2026
Find the contiguous subarray with the largest product in an integer array; because negatives and zeros can flip signs, you must track both the running…
Companies: LinkedIn, Microsoft
Array · Dynamic Programming
Last reported Feb 2026
Given an array of nonnegative integers representing house values, find the maximum sum you can obtain by selecting houses with the constraint that no two…
Companies: Amazon, Apple, Goldman Sachs, Microsoft
Array · Dynamic Programming
Last reported Jan 2026
Given an m×n binary matrix, find the area of the largest axis-aligned square submatrix that contains only '1's. This is a classic DP problem (m,n…
Companies: eBay, Expedia
Array · Dynamic Programming · Matrix
Last reported Jan 2026
Find the length of the longest contiguous "mountain" subarray — a strictly increasing sequence immediately followed by a strictly decreasing sequence with length ≥ 3…
Companies: Oracle, TikTok
Array · Dynamic Programming · Enumeration · Two Pointers
Last reported Nov 2025
Count how many ways to assign +/− to each element of nums so the signed sum equals target. This reduces to a subset-sum problem: count…
Companies: Meta, Pinterest
0-1 Knapsack · Array · Backtracking · Dynamic Programming
Last reported Nov 2025
Determine whether the array can be partitioned into two subsets with equal sum — equivalently, check if there exists a subset that sums to half…
Companies: Google, Microsoft
0-1 Knapsack · Array · Dynamic Programming · Knapsack Problem
Last reported Dec 2024
Count the number of length-goal sequences using n distinct songs such that every song appears at least once and a song can be replayed only…
Companies: Google, ServiceNow
Combinatorics · Dynamic Programming · Math
Last reported Jul 2024
Count the permutations of 1..n such that for every position i, either perm[i] is divisible by i or i is divisible by perm[i]. With n…
Companies: Rippling
Array · Backtracking · Bit Manipulation · Bitmask
Count the number of distinct sequences of 1- or 2-step moves that sum to n — the ways follow the recurrence ways(n)=ways(n-1)+ways(n-2) (i.e., Fibonacci-like), with…
Companies: Bloomberg, Google, Intuit, Meta +1
Dynamic Programming · Math · Memoization
Companies: Microsoft
Array · Dynamic Programming · Prefix Sum
Count the number of distinct subsequences of s that equal t — i.e., the number of ways to delete characters from s (keeping relative order)…
Companies: Swiggy
Dynamic Programming · String
Count the number of ways to tile a 2×n board using 2×1 dominoes and L-shaped trominoes (rotations allowed), returning the result modulo 10^9+7. The core…
Companies: Goldman Sachs
Dynamic Programming
Given a grid of integers (positive heal, negative damage) and moves only right or down, find the minimum positive initial health so the running health…
Companies: Intuit
Array · Dynamic Programming · Matrix
Split the stones into two groups to minimize the absolute difference of their total weights — equivalent to finding the largest subset sum ≤ total_sum/2…
Companies: Apple
0-1 Knapsack · Array · Dynamic Programming · Knapsack Problem
Find the length of the longest sequence of characters that appears in both input strings in the same relative order (not necessarily contiguous). This is…
Companies: Apple
Dynamic Programming · Longest Common Subsequence · String
Given an array of integers, return the length of the longest strictly increasing subsequence; the core challenge is to compute this efficiently—naive DP is O(n^2)…
Companies: PayPal
Array · Binary Search · Dynamic Programming · Longest Increasing Subsequence
Find the length of the longest subsequence of s that reads the same forwards and backwards — a classic dynamic programming problem (equivalently LCS between…
Companies: Goldman Sachs
Dynamic Programming · String
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