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 2,451–2,475
Find the leftmost index in an integer array where the sum of elements to its left equals the sum of elements to its right, returning…
General practice
Given n wizards (machines) and m potions (jobs) that must pass through all wizards in the given order, where processing time on wizard i for…
General practice
General practice
Given a binary matrix, find the minimum-area axis-aligned rectangle that contains every 1 by determining the extreme rows and columns where 1s appear. Return the…
General practice
Given an m×n (m,n ≤ 30) binary grid, partition all 1-cells into three non-overlapping axis-aligned rectangles of non-zero area (rectangles may touch) whose union covers…
General practice
Find a Hamiltonian cycle on nodes 0..n-1 where the directed edge cost from u to v is |u - nums[v]|, and return the permutation (cycle…
General practice
Given k (1 ≤ k ≤ 10^9), find the minimum number of Fibonacci numbers (repetition allowed) that sum to k — a coin-change style problem…
General practice
Choose n distinct positive integers with no two summing to target so that their total is minimized, and return that sum modulo 1e9+7. The core…
General practice
Given an unsorted array of integer IDs (possibly with duplicates) and a known expected ID range, find all IDs in that range that do not…
General practice
Given a list of daily survey responses, count each unique response per day (ignore duplicates within the same day) and return the response with the…
General practice
Return the length-k subsequence of nums (keeping original order) that is lexicographically smallest according to the "most competitive" definition. This is typically solved…
General practice
Starting from an array of n ones, apply k rounds of replacing each element by the prefix sum up to that index and return a[n-1]…
General practice
Count how many arrays copy of length n satisfy copy[i]-copy[i-1]=original[i]-original[i-1] and per-index bounds, noting that once you fix copy[0] the whole array is determined…
General practice
Given sequential recoloring queries on balls labeled in [0, limit], return after each update how many distinct (non-empty) colors are present. The core challenge is…
General practice
Count the number of pairs (i, j) such that nums1[i] is divisible by nums2[j] * k (i.e., nums1[i] % (nums2[j]*k) == 0). With n, m…
General practice
Count how many index pairs (i, j) satisfy nums1[i] being divisible by nums2[j] * k. With arrays up to 1e5 and values up to 1e6…
General practice
Count how many length-n arrays with elements in [1..m] have exactly k prefixes whose prefix sum is even (i.e., the prefix sum parity is even…
General practice
Count the ways to assign n labeled performers to x distinguishable stages (some stages may be empty) and then give each non-empty stage a score…
General practice
Count the subarrays whose first and last elements are equal and also equal to the maximum value in that subarray. The challenge is to do…
General practice
Count the number of ordered pairs of disjoint non-empty subsequences (seq1, seq2) of nums whose elements have the same GCD, returning the result modulo 10^9+7…
General practice
Count the number of ordered pairs (A,B) of distinct points where A is strictly to the left and above B (A.x < B.x and A.y…
General practice
Count ordered pairs of given points (Alice at the upper-left corner and Bob at the lower-right) such that the axis-aligned rectangle with those corners (possibly…
General practice
Given n players and a list of (player, color) picks, count how many players i have picked the same color at least i+1 times (player…
General practice
Given strings s and pattern, return the smallest starting index of a substring of s with the same length as pattern whose Hamming distance to…
General practice
Given an array pref of prefix XORs where pref[i] = arr[0] ^ ... ^ arr[i], reconstruct the unique original array arr. Use the XOR cancellation…
General practice