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,226–1,250
Find the number of spanning trees in an undirected graph where each vertex is labeled with an interval.
Companies: Google
Last reported Oct 2024
Given a list of N objects (~1000) and M binary features (~1000), determine the minimum number of binary questions needed to identify a specific object…
Companies: Google
Last reported Oct 2024
Compute the union area of up to 200 axis-aligned rectangles with coordinates up to 1e9, counting overlapping regions only once and returning the result modulo…
Companies: Google
Last reported Oct 2024
Given a string and a list of substrings, remove all occurrences of the substrings from the string. Determine if there are multiple possible final results…
Companies: Google
Last reported Oct 2024
Given an infinite series of switches, each initially in the 'on' position, determine the minimum number of operations required to turn off all switches. Each…
Companies: Google
Last reported Oct 2024
Pick k indices to maximize (sum of chosen nums1 values) * (minimum of the chosen nums2 values); the core challenge is trading off a large…
Companies: Google
Last reported Oct 2024
Maintain a dynamic set of disjoint, sorted intervals that summarize all integers seen from a stream, merging intervals when a new value is adjacent to…
Companies: Meta
Last reported Oct 2024
Generate a string that maximizes the score calculated by a given function. The function counts unique two-digit numbers in the string and returns the sum…
Companies: Microsoft
Last reported Oct 2024
Given a grid of homes (1s) find a meeting cell that minimizes the total Manhattan distance from all homes. Key insight: Manhattan distance is separable…
Companies: Google, Google DeepMind
Last reported Oct 2024
Given a graph with n friends at different locations and m possible meeting points (restaurants/cafes), find the optimal meeting location. The goal is to minimize…
Companies: Google, Meta
Last reported Oct 2024
Given an array where two players alternately take a number from either end, determine whether the first player can guarantee a win (ties count as…
Companies: Amazon
Last reported Oct 2024
Given a DAG with n nodes and directed edges, compute for each node the sorted list of all nodes that can reach it (its ancestors)…
Companies: Amazon
Last reported Oct 2024
Design an algorithm to count the number of users who have the least number of logins in the past 24 hours, ensuring the solution operates…
Companies: Amazon
Last reported Oct 2024
Given n flights and bookings [first, last, seats] that add seats to every flight in a range, compute the final seats per flight; the core…
Companies: Google
Last reported Oct 2024
Given a set of axis-aligned rectangles, find the largest-area axis-aligned square that can fit entirely inside the intersection region of at least two rectangles. The…
Companies: Google
Last reported Oct 2024
Count the Hamming weight (number of 1 bits) in the binary representation of a 32-bit integer. For many repeated calls, you can optimize by caching…
Companies: Google
Last reported Oct 2024
Given a weighted undirected graph, count the number of paths from node 1 to node n such that the shortest distance-to-node-n strictly decreases at every…
Companies: Google
Last reported Oct 2024
Sum each sender's total words across their messages and return the sender with the highest word count; if there’s a tie, return the case-sensitive lexicographically…
Companies: Google
Last reported Oct 2024
Return true if any integer appears at least twice in the array and false if all elements are distinct. Array length can be up to…
Companies: Google, Meta
Array · Hash Table · Sorting
Last reported Oct 2024
Determine if the multiset of integers can be partitioned into groups of size k where each group consists of k consecutive numbers. This requires that…
Companies: Google
Last reported Oct 2024
This question involves parsing web content (HTML documents or webpages) and applying tree/graph traversal algorithms. Tasks include converting HTML to tree structures…
Companies: Apple, Google
Last reported Oct 2024
Design and implement a data structure that simulates three stacks using a single static array. The operations should include push, pop, and peek for each…
Companies: Amazon
Last reported Oct 2024
Given an array and a start index, determine whether you can reach any index with value 0 by repeatedly jumping from index i to i…
Companies: Amazon
Last reported Oct 2024
Parse and evaluate a space-separated arithmetic expression with integers, multi-letter variables, parentheses and +, -, * (obeying precedence), applying given variable…
Companies: Google
Last reported Oct 2024
Sort a circular doubly linked list and return the head (the smallest element).
Companies: Meta
Last reported Oct 2024