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,651–2,675
Given a hidden array accessible only via a query API (e.g., compare elements or check equality), determine whether a value appears more than n/2 times…
General practice
Recover a hidden integer in a known range by issuing adaptive bitwise queries (e.g., asking about individual bits or masked bitwise results) and infer the…
General practice
Determine an unknown integer in a known range by interactively querying bitwise operations (AND/OR/XOR) between your chosen numbers and the secret; the challenge is to…
General practice
Given a non-decreasing array of citation counts, compute the h-index — the largest h such that at least h papers have ≥ h citations. Exploit…
General practice
Return the number of bit positions where two nonnegative integers differ (their Hamming distance). Key idea: XOR the two numbers and count the set bits…
General practice
Determine whether a multiset of card values can be partitioned into disjoint groups of a given size where each group consists of consecutive integers. Key…
General practice
Support three operations on two equal-length arrays: flip a range of bits in nums1, add p * nums1[i] to each nums2[i], and report the sum…
General practice
Given an even number of people seated around a circle, count the ways to pair them up with handshakes so that no two handshakes cross…
General practice
Count how many group sizes k (0 ≤ k ≤ n) make every student happy — equivalently, count k such that exactly k elements of…
General practice
Compute the sum of digits of the given integer x and return that sum if x is divisible by it (i.e., x is a Harshad…
General practice
Partition the string s into n/k blocks of length k and for each block compute the sum of character indices (a→0..z→25), take that sum mod…
General practice
Given positions of houses and heaters on a line, find the minimum uniform radius R such that every house is within distance R of some…
Companies: Anduril
Array · Binary Search · Sorting · Two Pointers
Count how many indices in the given heights array differ from the array sorted in non-decreasing order (the expected lineup). Values are small (1–100), so…
General practice
Given a rooted binary tree and m independent queries that remove the entire subtree rooted at a specified node (never the root), return the tree…
General practice
Given a binary tree with a restrictive structural property (e.g., complete/perfect), compute its height (number of levels) by exploiting that structure to avoid visiting every…
General practice
Compute n^2 and n^3, convert n^2 to an uppercase hexadecimal (base-16) string and n^3 to an uppercase hexatrigesimal (base-36) string, and return the concatenation of…
General practice
Convert the given decimal number to uppercase hexadecimal and determine if every hex digit is either 0,1 or A–F; if so, map 0→'O' and 1→'I'…
General practice
Given a list of (studentId, score) pairs, compute each student's average of their top five scores and return the results as (studentId, average) sorted by…
Companies: Goldman Sachs
Array · Hash Table · Heap (Priority Queue) · Sorting
Given a list of grade records (student name and score), group entries by student and compute each student's maximum score. Return the highest grade per…
General practice
Given a list or table of employee salaries, compute the difference between the highest and the second-highest distinct salary (or return an appropriate null/indicator if…
General practice
Companies: Apple
Given a dataset of companies and employees and a sequence of queries asking aggregated results (e.g., counts, top/bounds, or filtered selections) possibly interleaved with…
General practice
Given a rooted company hierarchy and many queries about employee relationships (for example k-th ancestor or ancestor checks), preprocess the tree so you can answer…
General practice
Given a company hierarchy as a tree and a long sequence of mixed operations that update node states and ask for distance/connectivity/ancestor-related answers, process all…
General practice
Select at least k non-adjacent houses so as to minimize the maximum value stolen from any chosen house — equivalently, find the smallest threshold T…
General practice