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,051–3,075
Given which interior horizontal and vertical bars can be removed from an (n+1)×(m+1) grid, remove some subset to merge adjacent unit cells and form the…
General practice
Given an array where each element can be increased by at most 1, find the largest subset of elements that can be (after optional increments)…
General practice
After each point update, treat each prime value as an interval [min_index, max_index] of its occurrences; the sum of distinct primes in prefix+suffix for split…
General practice
Companies: Amazon, Google
Array · Dynamic Programming
Given a binary array where 1s are occupied seats, find an empty seat that maximizes the distance to the nearest occupied seat. The core challenge…
Companies: Adobe, Roblox
Array
Companies: Amazon
Array · Binary Search · Sorting
Given an integer array, permute its elements to maximize the number of indices i with perm[i] > nums[i]. The core challenge is a matching problem…
General practice
Place up to given numbers of introverts and extroverts on an m×n grid (neighbors are 4-directional) where each type has different base happiness and per-neighbor…
General practice
Pick k elements sequentially from an array where each selection reduces every remaining positive value by 1 (clamped at 0); determine the maximum total sum…
General practice
Given a list of items with costs and a limited resource or set of operations (budget, coupons, removals, etc.), determine the maximum number of items…
General practice
Companies: Amazon
Array · Binary Search · Dynamic Programming · Sorting
Split the given budget of prime factors into exponents e1+e2+... ≤ primeFactors to maximize the product e1*e2*... (each ei≥1), because the number of nice divisors…
General practice
Given a text and a length-2 pattern, you may insert either pattern[0] or pattern[1] exactly once anywhere; maximize how many times the pattern appears as…
General practice
Given two strings, pick a non-empty subsequence from each, concatenate them, and return the maximum length of a palindrome obtainable; equivalently, find the longest…
General practice
Companies: Amazon
Array · Greedy · Heap (Priority Queue) · Sorting
Pair up the 2n integers and assign an operation order to maximize the sum of i * gcd(x,y) over n operations (each operation removes a…
General practice
Given a sequence where you can repeatedly remove pairs of elements (following the problem’s pairing rules) and earn a score for each removed pair, compute…
General practice
Given n intervals [start[i], start[i]+d], pick one integer from each interval to maximize the minimum pairwise absolute difference among the chosen numbers. This is a…
General practice
Find a spanning tree that maximizes the minimum edge strength (stability) when some edges are mandatory (must be included and cannot be upgraded) and up…
General practice
Given an array nums and up to k operations that can double distinct elements (each at most once), choose a contiguous subarray and up to…
General practice
Given an integer array, you may (at most once) choose a value x and remove all its occurrences (keeping the array non-empty); return the largest…
General practice
Given nums = [1..n] and a set of conflicting pairs [a,b] that forbid any subarray containing both a and b, remove exactly one pair to…
General practice