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,401–4,425
Given equal-length anagram strings, group them into connected components where an edge connects two strings if they are identical or can be made equal by…
General practice
Return all reduced fractions a/b with 0 < a < b ≤ n (i.e., gcd(a,b)=1) that lie between 0 and 1; with n ≤ 100…
General practice
Given an array where every element appears exactly three times except one that appears once, identify that unique element in O(n) time and O(1) extra…
General practice
Given an array where every number appears twice except for two distinct numbers, find the two unique numbers in O(n) time and O(1) extra space…
General practice
Given a permutation of the 26 lowercase letters representing a single-row keyboard and a target word, compute the total time to type the word starting…
General practice
Implement an asynchronous function sleep(millis) that returns a Promise which resolves after approximately millis milliseconds (minor timing deviations acceptable). Constraint…
General practice
For each size-k sliding window, return the x-th smallest negative number (or 0 if the window has fewer than x negatives), requiring a sliding-window order-statistics…
General practice
Companies: Citadel
Given releaseTimes and keysPressed for sequential keypresses, compute each press duration (releaseTimes[0] and releaseTimes[i]-releaseTimes[i-1]) and return the key with the…
General practice
Given an integer array, compute its average (as a real number) and return the smallest positive integer strictly greater than that average which does not…
General practice
Find the smallest integer >= n whose product of digits is divisible by t. With the given small bounds (n ≤ 100, t ≤ 10)…
General practice
Find the smallest zero-free decimal string >= num whose digits' product is divisible by t. The core challenge is combining digit-DP/greedy with number-theoretic factorization…
General practice
Return the least common multiple of n and 2 — equivalently, output n if n is even, otherwise 2*n.
General practice
Given n (<= 1e18), find the smallest integer base k >= 2 such that n's base-k representation is all 1s — i.e., n = 1…
General practice
Given an integer N and two decimal digits a and b, find the smallest integer strictly greater than N that is a multiple of N…
General practice
Find the smallest index i in nums such that the sum of the decimal digits of nums[i] equals i, or return -1 if no such…
General practice
Find the smallest index i in the array such that i mod 10 == nums[i], or return -1 if none exists. This is a simple…
General practice
Find the minimum length L such that the repunit (a number consisting of L copies of digit '1') is divisible by k, returning -1 if…
General practice
Find the lexicographically smallest subsequence of length k from s that contains at least repetition occurrences of a given letter. This requires a greedy, monotonic-stack-like…
General practice
Given a rooted tree where each node has a distinct genetic value (1..1e5), compute for every node the smallest positive integer (mex) that is missing…
General practice
Find the longest prefix starting at nums[0] where each element increments by 1, compute its sum S, and return the smallest integer x >= S…
General practice
Companies: Amazon, Bloomberg, Google, Microsoft
Array · Hash Table
Because adding/subtracting value preserves each element's remainder modulo value, each number can become any integer in its congruence class; the task is to maximize the…
General practice