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 1,501–1,525
Support inserting obstacles at points on the nonnegative number line and, for each query, determine whether there exists any obstacle-free interval of length >= sz…
Companies: Hudson River Trading, Roblox, TikTok
Array · Binary Indexed Tree · Binary Search · Ordered Set
Given weights and a per-boat weight limit where each boat holds at most two people, minimize the number of boats by optimally pairing passengers —…
General practice
Given a list of words and a string, wrap every substring that matches any word with ... , ensuring overlapping or adjacent matches are merged…
General practice
Given a grid with walls, enemies, and empty cells, find the maximum number of enemies that can be killed by placing a bomb in a…
General practice
Support two booking operations on n rows with m seats each: gather(k,maxRow) must find the smallest row ≤ maxRow with k consecutive free seats and…
General practice
Given a Books table, write an SQL query to list all books whose rating is missing (rating IS NULL), correctly handling SQL NULL semantics and…
General practice
Given a string with brace-enclosed comma-separated option groups and implicit concatenation (e.g., "{a,b}c{d,e}"), generate all unique strings formed by choosing one option…
Companies: Anduril
Backtracking · Breadth-First Search · Sorting · Stack
Parse a nested brace expression where {a,b} denotes union and adjacency denotes concatenation, and compute the set of all distinct strings produced by applying unions…
General practice
Given a palindromic lowercase string, change exactly one character to produce the lexicographically smallest string that is not a palindrome (or return empty if impossible)…
General practice
Given rows of brick widths with equal total width, find a vertical line (not on the two outer edges) that crosses the fewest bricks —…
General practice
Given an m×n grid where a brick is stable if connected to the top (directly or via neighboring bricks), apply a sequence of hits that…
General practice
Given lights described by a position and illumination range, find the street coordinate that is covered by the maximum number of lights (return the smallest…
General practice
Given startValue and target, compute the minimum operations to reach target using multiply-by-2 and minus-1; the optimal approach is to work backwards from target applying…
General practice
Determine whether swapping exactly two characters in s can make it equal to goal: return true if s and goal have the same length and…
General practice
Place numbers 1..k into a k×k grid (one per cell) so that given pairs enforce which number must appear in a strictly higher row or…
General practice
Given a strictly increasing target array drawn from 1..n, simulate reading the stream 1..n and output "Push" for each number you read, followed by "Pop"…
General practice
Given a zero-based permutation nums, return an array ans of the same length where ans[i] = nums[nums[i]] for every index i (i.e., compute the permutation…
General practice
Count the number of length-n arrays with values in [1, m] such that, when scanning left-to-right, a new maximum is found exactly k times (i.e.…
General practice
Given an infix arithmetic expression string, construct a binary expression tree where internal nodes are operators and leaves are operands, ensuring the tree reflects operator…
General practice
Given a sequence of digits/numbers, construct valid mathematical expressions (using concatenation, the four basic operators and optional parentheses) that evaluate to a target…
General practice
Place n unit cubes into stacks on an n×n floor with the rule that a cube can be stacked only if the supporting cube's four…
Companies: Adobe
Binary Search · Greedy · Math
Coordinate hydrogen and oxygen threads so they pass a barrier in groups of three forming H2O: ensure exactly two H threads and one O thread…
General practice
Given n bulbs toggled on each i-th round for multiples of i, determine how many bulbs remain on after n rounds — this reduces to…
Companies: LinkedIn
Brainteaser · Math
Given n bulbs initially on and four toggle operations (flip all / evens / odds / positions 3k+1), determine how many distinct final configurations are…
General practice