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,626–4,650
Given k eggs and an n-floor building, find the minimum number of drops required in the worst case to determine the highest floor f from…
General practice
Count how many numbers in [left, right] are palindromes that are perfect squares whose integer square roots are also palindromes. Because right ≤ 10^18, the…
General practice
Compute a^b mod 1337 where a is an integer and b is an extremely large exponent given as an array of decimal digits; the key…
General practice
Return the nth positive integer whose prime factors are all drawn from the given list primes (the generalized "super ugly numbers"). With n up to…
General practice
Given an array of dress counts where in each move any subset of machines can simultaneously pass one dress from each selected machine to one…
General practice
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand (e.g., [4,5,6,7,0,1,2]). Search for a target value and return…
Companies: Apple
Given an n×n grid of tower heights, compute the total exposed surface area of the glued unit cubes by summing top/bottom and side faces for…
General practice
Given an m x n board of 'X' and 'O', flip all 'O' cells that belong to regions completely surrounded by 'X' to 'X' (regions…
General practice
Given a list of transactions [name, time, amount, city], identify account holders with suspicious activity — either any transaction amount > 1000 or two transactions…
General practice
Given a lowercase string where you may swap any two characters once, find the maximum length of a substring consisting of the same character after…
General practice
Write a single SQL UPDATE that toggles every row's sex value between 'm' and 'f' (i.e., swap 'm'->'f' and 'f'->'m') without using any SELECTs or…
General practice
Given a set of 2D integer coordinates, determine whether the point set is reflection-symmetric about a vertical line (i.e., for every point there exists a…
General practice
Given pairs of synonymous words and a sentence, generate all distinct sentences formed by replacing any word with any of its synonyms (synonym relations are…
General practice
Validate whether a string is a single correctly wrapped XML-like code snippet by parsing tags, CDATA blocks, and text to ensure tags are properly nested…
General practice
Repeatedly for k seconds, pick the current largest pile, replace its size with floor(sqrt(size)), and return the total remaining gifts; the core challenge is efficiently…
General practice
Given a string of 'a', 'b', 'c' and integer k, compute the minimum number of characters you must take from the ends to collect at…
General practice
Given an array and a step k, pick a starting index and sum the values at i, i+k, i+2k, ... until you fall off the…
General practice
Given a list of rod lengths, choose two disjoint subsets whose sums are equal and as large as possible (welding rods allowed); return that maximum…
General practice
Given a schedule of tasks over a date range or with a recurrence pattern, count how many of those tasks fall on weekend days (Saturday/Sunday)…
General practice
Given players as nodes and pairwise pass-success probabilities as directed edge weights, determine whether and how a team can achieve dominance—e.g., maximize the probability…
General practice
Given a list of match results in a round-robin football tournament, compute each team’s total points (and optionally secondary stats like goal difference) by aggregating…
General practice
Given sorted attack times and a fixed poison duration, compute the total number of seconds the target is poisoned — equivalently, the length of the…
General practice
Read a text file and print only its 10th line. If the file has fewer than 10 lines, produce no output (or otherwise handle the…
General practice
Parse and evaluate a nested ternary expression string (with single-character operands and '?' and ':' operators), respecting the ternary operator's right-to-left associativity…
General practice