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,451–1,475
Simulate the operations using a stack: push integer scores, '+' pushes the sum of the last two scores, 'D' pushes double the last score, and…
General practice
Count how many non-adjacent battleships (each a straight 1×k or k×1 segment) appear in an m×n grid of 'X' and '.' cells. Because ships never…
General practice
Count the permutations of 1..n such that for every position i, either perm[i] is divisible by i or i is divisible by perm[i]. With n…
Companies: Rippling
Array · Backtracking · Bit Manipulation · Bitmask
Construct a permutation of 1..n such that the multiset of absolute differences between consecutive elements contains exactly k distinct values. The typical challenge is to…
General practice
Return a permutation of 1..n with the property that no element sitting between two others equals their arithmetic mean (i.e., no i<k<j with 2*nums[k]=nums[i]+nums[j]). The…
General practice
Given one or two arrays, compute how many index pairs (or the maximum matching of pairs) satisfy a non‑trivial "beautiful" predicate (e.g., equality/modular/gcd/bitwise/sum…
General practice
Given an array of tower heights where you may only decrease values, reshape it into a mountain (nondecreasing up to one or more equal peak(s)…
General practice
Given a list of phrases, produce all unique "before-and-after" phrases formed by concatenating phrase A and phrase B whenever the last word of A equals…
General practice
Companies: Jane Street
Given five cards as parallel arrays of ranks and suits, return the best poker hand among "Flush", "Three of a Kind", "Pair", or "High Card"…
General practice
Find the geometric median of up to 50 2D points — the point that minimizes the sum of Euclidean distances to all customers — and…
General practice
Given an array values, find the maximum score values[i] + values[j] + i - j for i < j, which reduces to maximizing (values[i] +…
General practice
Select a subset of players (max size 1000) with maximum total score under the constraint that no younger player has a strictly higher score than…
General practice
Given arrays prices and strategy, you may (once) replace any k consecutive actions by k/2 holds followed by k/2 sells to maximize the sum of…
General practice
Given daily prices and an integer k, pick at most k non-overlapping transactions (each is a pair of days i<j where you either buy-then-sell or…
General practice
Given daily stock prices, maximize total profit with unlimited buy/sell transactions under the constraint that after you sell you must skip the next day (one-day…
General practice
Companies: Citadel
Array · Dynamic Programming
Given daily prices and a per-transaction fee, maximize profit from any number of buy-sell operations (you cannot hold multiple shares at once) where each completed…
General practice
Given a string composed of character–count pairs (with counts possibly multi-digit and the same character appearing multiple times), parse and sum counts for each character…
General practice
Retrieve the name, population, and area of countries from the World table that qualify as "big"—those with area ≥ 3,000,000 km² or population ≥ 25,000,000…
General practice
Given a table of integers that may contain duplicates, identify the largest value that appears exactly once (a "single number"); return null if no such…
General practice
Given a chronological list of location/site visits, compute the largest gap (number of steps or days) between two consecutive visits to the same location and…
General practice
Bike map question Leetcode question
Companies: Stripe