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 3,101–3,125
Companies: Amazon, Bloomberg, Google, Meta
Array · Greedy · Sorting
Find the maximum-sum path from the top-left to bottom-right of an m×n grid moving only right or down, where cell values may be negative but…
General practice
Compute the total sum of the minimum plus maximum element for every subarray of nums with length at most k. The challenge is to do…
General practice
Compute the sum of minimum and maximum elements across all subsequences of nums of size ≤ k. Sort nums and use combinatorics to count how…
General practice
Place each number into one of numSlots (each slot holds at most two numbers) to maximize the sum of (number AND slotIndex). With numSlots ≤…
General practice
Sort the horizontal and vertical cut positions and find the largest gap between consecutive cuts (including the distances to the cake edges). The maximum piece…
General practice
Companies: American Express, Google
Array · Binary Search · Dynamic Programming · Matrix
Given up to 2e5 unique points, find the largest-area axis-aligned rectangle whose four corners are points from the set and that contains no other point…
General practice
Given an array and rules for hopping between indices that collect the values you land on (typically with constraints like a limited hop range or…
General practice
Given an array of positive integers, return the maximum sum of any contiguous strictly increasing subarray. The core challenge is to identify increasing runs and…
General practice
Given classes with current pass/total counts and some extra students who always pass, assign the extras to maximize the overall average pass ratio; the core…
General practice
Given an array of numbers and an integer k, find the maximum possible average of any contiguous subarray with length at least k. The typical…
General practice
Given a binary tree of numeric node values, find the subtree (a node plus all its descendants) with the maximum average value; solve by a…
General practice
Given capacities, current rocks, and a budget of additional rocks, maximize the number of bags that reach full capacity by computing each bag's deficit and…
General practice
Select the maximum number of non-overlapping contiguous subarrays such that in each chosen segment the last element is strictly less than the maximum element of…
General practice
Choose a subsequence maximizing sum under the constraint nums[i_j] - nums[i_{j-1}] >= i_j - i_{j-1], which is equivalent to requiring the transformed values v[i] =…
General practice
Given nums and k where each element can be changed once to any integer in [nums[i]-k, nums[i]+k], find the maximum length of a subsequence of…
General practice
Given a binary string, repeatedly apply the local rewrite rules "00" -> "10" and "10" -> "01" to produce the largest possible binary number (by…
General practice
Given an array of distinct integers, construct the maximum binary tree by repeatedly choosing the maximum element as the root and recursively building the left…
General practice
Given a maximum binary tree and a value val appended to the original array, produce the new maximum tree that would result from appending val…
General practice
Companies: Microsoft
Bit Manipulation · Greedy · String
Given n buildings in a line with height1 = 0, nonnegative integer heights, adjacent height differences ≤ 1, and some positions having upper bounds, compute…
General practice
Companies: Amazon
Array · Greedy · Sorting · Two Pointers
Companies: Amazon, Microsoft
Array · Binary Search · Sorting · Two Pointers
Given a grid or graph of coin values and movement constraints (e.g., move from a start to an end cell, possibly with a return trip…
General practice