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 4,851–4,875
Given n 2D points, find the maximum width of a vertical strip that contains no points — equivalently, the largest gap between consecutive x-coordinates when…
General practice
Reorder an unsorted array in-place into a wiggle sequence such that nums[0] < nums[1] > nums[2] < nums[3] ... (or any equivalent alternating < and…
General practice
Reorder an integer array into a wiggle sequence nums[0] < nums[1] > nums[2] < nums[3] ... while correctly handling duplicates (a valid arrangement is guaranteed)…
General practice
Find the length of the longest subsequence of an array whose consecutive differences strictly alternate in sign (zeros don't count as a change). The core…
General practice
Given a list of votes for candidates, determine which candidate wins under the problem's rules (typically most votes with a specified tie-breaker such as earliest…
General practice
Given a pattern and a string, determine whether you can assign each pattern character to a non-empty substring of the string (different characters map to…
General practice
Given a list of equal-length words, find all n×n "word squares"—orderings of n words where the ith row equals the ith column for all i…
General practice
Companies: Oracle
Array · Backtracking · Enumeration · Sorting
Return all strings a in words1 that are "universal" — meaning for every b in words2, every character in b appears in a with at…
General practice
Companies: Anthropic
Companies: Anthropic
Determine whether the multiset of card values can be partitioned into groups of equal size x>1 with each group containing identical values — equivalently, check…
General practice
Given nums and queries [l, r, k, v], each query multiplies every element at indices i = l, l+k, l+2k, ... ≤ r by v…
General practice
Given nums and queries [l,r,k,v] that multiply every element at indices l, l+k, l+2k,... ≤ r by v (mod 1e9+7), return the bitwise XOR of…
General practice
Compute the bitwise XOR of the n-element array defined by nums[i] = start + 2*i (an arithmetic progression with step 2). The task tests using…
General practice
Given an array and many queries [left, right], return the XOR of elements in each subarray arr[left..right]. Precompute a prefix-xor array to answer each query…
General practice
Compute year-over-year growth rates for time-series records by grouping entries (e.g., by entity or metric), comparing each year with its previous year to produce percentage…
General practice
Given an array nums and a sequence of interval queries where each query lets you decrement any subset of elements in that interval by 1…
General practice
Given range queries that can decrement each index in their range by up to val independently, find the smallest prefix length k such that for…
General practice
Given nums and range queries where each query can reduce any element in its range by at most 1 (chosen independently per index), find the…
General practice
Find the smallest prefix length k such that for every index i, nums[i] can be formed as the sum of some subset of the values…
General practice
Traverse the m×n grid in a row-wise zigzag (left-to-right on the first row, right-to-left on the next, etc.) starting at (0,0), and collect the values…
General practice