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,226–2,250
Given a rope implemented as a binary tree where leaves hold characters/strings and internal nodes store the length (weight) of their left subtree, return the…
General practice
Given an integer n, return all unique combinations of integers greater than 1 (and less than n) whose product equals n, with factors in non-decreasing…
General practice
Implement a function or generator that produces factorial values (e.g., returns n! or yields the sequence 0!..n!), correctly handling the base case 0! = 1…
General practice
Return the number of trailing zeros in n! by determining how many times 10 divides n!, which reduces to counting factors of 5 in the…
General practice
Given two arrays of positive integers representing candy box sizes for Alice and Bob, find one pair (a from Alice, b from Bob) such that…
General practice
Partition a small array of cookie counts (n ≤ 8) into exactly k groups (each bag assigned whole) to minimize the maximum group sum —…
General practice
Given a sequence of squares specified by left coordinate and side length, simulate dropping them onto the x-axis where each square lands on top of…
General practice
Support append, addAll, multAll, and getIndex on a sequence under up to 1e5 operations, where addAll/multAll affect all existing elements and results are modulo 1e9+7…
General practice
Simulate typing through string s where each non-'i' character is appended to the current text and each 'i' causes the entire current text to be…
General practice
Given an array of sensor readings where one sensor produces an incorrect/outlier value that breaks the expected pattern or consensus, identify the faulty sensor (or…
General practice
Construct a 2^n x 2^n permutation of integers 0..2^(2n)-1 so that the four quadrants (top-right, bottom-right, bottom-left, top-left) have strictly increasing value ranges…
General practice
Given a products table/DataFrame, replace missing (NULL) values in the quantity column with 0 and return the updated table.
General practice
Partition the ordered list of books into contiguous shelves so each shelf's total thickness ≤ shelfWidth and the shelf height equals the maximum book height…
General practice
Given a string and a frequency criterion, return only the characters that meet that frequency condition (e.g., appear exactly/at least/within k times) as specified by…
General practice
Implement a custom filter that iterates an integer array and returns a new array containing only the elements for which the provided predicate fn(element, index)…
General practice
Filter the list of restaurants by an optional vegan flag and maximum price and distance, then return the restaurant IDs sorted by descending rating with…
General practice
Perform k repeated updates on nums where each step finds the current minimum element (choosing the first occurrence on ties) and replaces it with x…
General practice
Repeatedly replace the leftmost minimum in nums with itself times multiplier for k operations and return the array modulo 1e9+7. The core challenge is handling…
General practice
Companies: Amazon
Array · Brainteaser · Game Theory · Math
Given a list of increment/decrement operation strings applied to a single variable X starting at 0, compute the final value by iterating through the operations…
General practice
Given an original binary tree, its deep copy (cloned), and a reference to a target node in the original, return the reference to the corresponding…
General practice
Given m binary rows (n ≤ 5), find any nonempty subset of row indices such that for each column the number of 1s in the…
General practice
Given an m x n matrix where adjacent cells differ, find any cell that is strictly greater than its up/down/left/right neighbors (a 2D peak). Do…
General practice
Given an array and a target, find the minimum absolute difference between target and the bitwise AND of any subarray arr[l..r]. The core challenge is…
General practice