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,151–1,175
Given a string containing non-nested bracketed keys and a list of key→value pairs, replace each "(key)" with its corresponding value or "?" if the key…
Companies: Google
Last reported Jan 2025
Count the number of valid Android lock patterns on a 3x3 grid with length between m and n, where a move that jumps over a…
Companies: Google
Last reported Jan 2025
Companies: Google
Last reported Jan 2025
Given an undirected connected acyclic graph where each node has at most 3 edges, and nodes are colored (either Black/White or Red/Black), find a root…
Companies: Google
Last reported Jan 2025
Given an undirected connected acyclic graph where each node has at most 3 edges and nodes are colored (Red/Black/White or similar color patterns), find a…
Companies: Google
Last reported Jan 2025
Calculate total completion time for tasks with subtasks, where the parent task time is the sum of subtasks or x if all subtasks have time…
Companies: Google
Last reported Jan 2025
Remove exactly k elements from an integer array to minimize the number of distinct values remaining. This reduces to counting element frequencies and greedily eliminating…
Companies: Google
Last reported Jan 2025
Given an integer array, compute the maximum score obtainable by starting at index 0 and repeatedly hopping forward under a constraint (e.g., a maximum jump…
Companies: Google
Last reported Jan 2025
Given a list of tree coordinates in a forest and a camera with a fixed degree of visibility, find the minimum set of angles to…
Companies: Google
Last reported Jan 2025
Given an array of length 3n, remove exactly n elements so the remaining 2n elements (split into the first n and last n) have the…
Companies: Amazon
Last reported Jan 2025
Given a circular array where each second every element can take its own or a neighbor's value (so values propagate outward one step per second)…
Companies: Amazon
Last reported Jan 2025
Find the length of the shortest contiguous subarray whose sum is at least k, or return -1 if none exists. Because nums can contain negative…
Companies: Meta
Array · Binary Search · Heap (Priority Queue) · Monotonic Queue
Last reported Jan 2025
Companies: Citadel
Last reported Jan 2025
Given an array of positive integers where you can merge any two adjacent elements into their sum, compute the minimum number of such merges required…
Companies: Amazon
Last reported Dec 2024
Find all distinct 10-letter substrings of a DNA string that occur more than once. This is typically solved by scanning with a sliding window and…
Companies: Google
Last reported Dec 2024
Given a complete binary tree, return its node count in less than O(n) time by exploiting the tree’s completeness (all full levels except a left-filled…
Companies: Amazon, Google
Last reported Dec 2024
Count the number of index triplets (i < j < k) in arr such that the pairwise absolute differences satisfy |arr[i]-arr[j]| ≤ a, |arr[j]-arr[k]| ≤…
Companies: Google
Last reported Dec 2024
Given a binary tree, for each leaf node find the maximum value among all of its ancestor nodes (from root to that leaf's parent). Return…
Companies: Google
Last reported Dec 2024
Given start digit, moveCost, pushCost and targetSeconds, find the minimum fatigue to enter up to four digits (zero-padded to MMSS) whose minutes*60 + seconds =…
Companies: Google
Last reported Dec 2024
Determine whether the array can be partitioned into two subsets with equal sum — equivalently, check if there exists a subset that sums to half…
Companies: Google, Microsoft
0-1 Knapsack · Array · Dynamic Programming · Knapsack Problem
Last reported Dec 2024
Given an API read4 that reads up to 4 characters from a file into a temporary buffer, implement read(buf, n) to copy up to n…
Companies: Google
Last reported Dec 2024
Given two equal-length word arrays and a list of similar word pairs where similarity is transitive, determine whether each pair of words at the same…
Companies: Google
Last reported Dec 2024
Find the shortest string that contains both input strings as subsequences — essentially merge them minimizing length by maximizing their overlap. This is solved by…
Companies: Google
Last reported Dec 2024
Return the nth highest distinct salary from the Employee table (or null if there are fewer than n distinct salaries). This tests handling duplicates and…
Companies: Amazon
Last reported Dec 2024
Convert an array of objects into a 2D matrix by extracting a header row of all unique keys (in a specified order) and aligning each…
Companies: Google
Last reported Dec 2024