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,726–4,750
Compute the total usable fuel when every time 5 liters are consumed from the main tank an instantaneous 1-liter transfer occurs from the additional tank…
General practice
Given an array of nonnegative integers, compute the sum of Hamming distances over all pairs of numbers. Key idea: for each bit position, count how…
Companies: Apple
Array · Bit Manipulation · Math
Aggregate total sales per year by extracting the year from sales/order dates and summing the amounts, handling nulls or missing years and returning results in…
General practice
Companies: Amazon
Array · Depth-First Search · Tree
Given a sequence of positions or movement updates, compute the total distance traveled by summing the distances between consecutive positions (absolute differences in 1D or…
General practice
Companies: Amazon, Google
Dynamic Programming · Enumeration · Math
Companies: Amazon, Bloomberg, Google, Microsoft
Dynamic Programming · Math
Given a set of players with some match results and remaining games, determine which players can still finish first under some assignment of outcomes; the…
General practice
Map each element to its parity (even -> 0, odd -> 1) and return the array sorted non-decreasing. Equivalently, count evens and odds and output…
General practice
Given an array of ±1, you may flip the signs of any adjacent pair (multiply two consecutive elements by -1) up to k times; decide…
General practice
Companies: Amazon, BlackRock
Array · Greedy · String · Two Pointers
Given a circular integer array nums, build result where for each index i you move |nums[i]| steps from i (right if nums[i]>0, left if nums[i]<0…
General practice
Given a space-separated text file where each row has the same number of columns, output its transpose by converting columns into rows (i.e., the i-th…
General practice
Given an m×n integer matrix, return its transpose (flip over the main diagonal) producing an n×m matrix where element at (i, j) becomes (j, i)…
General practice
Given an m x n height map, compute the total volume of water that can be trapped after raining across the 2D elevation grid. The…
General practice
Given an undirected tree, find its diameter — the maximum distance (sum of edge weights, or number of edges if unweighted) along any simple path…
General practice
Given a table of node ids and parent ids forming a valid tree, classify each node as "Root" (p_id is null), "Leaf" (no children, i.e.…
General practice
Given a rooted tree with a value on each node, for every node return the nearest ancestor whose value is coprime with the node's value…
General practice
Find the minimum sum path from the top to the bottom of a triangular array where at each step you may move to one of…
General practice
For each row of three integers (x, y, z) representing segment lengths, determine whether they can form a non‑degenerate triangle by checking that the sum…
General practice