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,501–2,525
Partition the array into two nonempty subsets to minimize |max(nums1) - min(nums2)| — equivalently, find a cut that separates the array so the chosen max…
General practice
Compute, for each column, the maximum printed length of its integers in base-10 (count digits plus one if negative) by scanning the column and returning…
General practice
Given n people seated in a circle, repeatedly remove every k-th person clockwise until one remains and return their label — the classic Josephus problem…
Companies: Goldman Sachs
Array · Math · Queue · Recursion
Players alternately must pick coins summing to 115, which can only be done by taking one 75 and four 10 coins, so the game reduces…
General practice
Given an array where each number appears either once or twice, return the bitwise XOR of all numbers that occur exactly twice (or 0 if…
General practice
Given a list/table of transactions (with user IDs and timestamps/amounts), return each user's third transaction when ordered by time (or specified ranking), handling users with…
General practice
Determine whether num can be written as a length-3 arithmetic progression of consecutive integers whose sum is num; using the fact that the middle element…
General practice
Given multiple bacterial strains with initial populations and growth behavior and a limited kill capacity per action/time unit, determine the minimum time required to reduce…
General practice
Given ride/driver records, compute each driver's performance metric (e.g., total earnings, average rating, or trips) with any required filters or minimum-count constraints…
General practice
Given an answer key and each student's repeating answer pattern, compute each student's correct-answer count by comparing their pattern against the key and return the…
General practice
Compute each student's total score from the given inputs and return the top-k students (applying required tie-break rules). The challenge is to aggregate scores at…
General practice
Group employee time-entry records by emp_id and event_day and compute total_time as the sum of (out_time - in_time) for each group. Note that in_time <…
General practice
Given a stream or list of time-stamped hashtag occurrences, compute the top-k trending hashtags within a recent time window or period by maintaining/updating frequency counts…
General practice
Design a data structure to ingest a high‑volume stream of timestamped hashtags and efficiently return the top‑k trending hashtags over a recent sliding time window…
General practice
Given an array of digits, repeatedly replace it by the array of adjacent pairwise sums modulo 10 until only one number remains and return that…
General practice
Find two non-overlapping subarrays of positive integers that each sum to target and return the minimum possible total length of those two subarrays (or -1…
General practice
Given n distinct binary strings each of length n, return any n-bit string that does not appear in the array. This leverages the pigeonhole/Cantor diagonalization…
General practice
Process reaction CSVs and identify the user pair with the largest overlap of liked jobs.
Companies: Otta / WTTJ
Return users whose mail matches a validation rule: the local part must start with a letter and contain only letters, digits, underscores, periods, or dashes…
General practice
Return rows whose email matches the pattern local@domain.com where the local part contains only alphanumeric characters and underscores, the domain (between @ and .com)…
General practice
Given vectors rowSum and colSum, construct any non-negative integer matrix whose row and column totals match the given sums (a solution is guaranteed). This is…
General practice
Find the first adjacent pair of distinct digits in the string (scanned left-to-right) such that each digit's total frequency in the entire string equals its…
General practice
Given a weighted tree and many queries (u, v), find the first node along the path from u to v where the cumulative edge weight…
General practice