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 3,401–3,425
Given a list of events with start/end times and hall identifiers, consolidate each hall's schedule by merging any overlapping (or contiguous, if specified) time intervals…
General practice
Given two lists of (value, weight) pairs where values are unique within each list, merge entries with the same value by summing their weights and…
General practice
Interleave two strings by alternately taking characters from each starting with word1 and, if one string is longer, append its remaining characters to the end…
General practice
You are given 3-element arrays and can repeatedly replace a triplet with the coordinate-wise max of two triplets; determine whether you can produce the exact…
General practice
Merge two sorted lists of [id, value] pairs with unique ids into a single list sorted by id, summing values for ids that appear in…
General practice
Given a DataFrame of animals, return the names of animals with weight > 100 sorted by weight in descending order. Do this as a single-line…
General practice
Assign each of n cheeses to one of two mice so the first mouse eats exactly k items and the total reward (reward1 for first…
General practice
Find the minimum total cost to reach the top when you may start at index 0 or 1 and at each move climb 1 or…
General practice
Given N points, compute the minimum total Manhattan distance required to connect them so that the resulting graph is a tree (exactly one simple path…
General practice
Given an array whose length is a power of two, repeatedly reduce it by forming a new array where each even index takes the min…
General practice
Companies: Amazon
Array · Greedy · Hash Table · Math
Given a set of intervals on the number line, determine where to insert one additional interval (often of fixed length) to maximally connect/merge existing intervals…
General practice
Given an array of positive integers where you may repeatedly halve even numbers and can double odd numbers (to make them even), compute the minimum…
General practice
Interpret allowedSwaps as edges of an undirected graph: any indices in the same connected component can be arbitrarily permuted, so to minimize Hamming distance you…
General practice
Given an array of positive integers, you may repeatedly pick two positive elements, append their remainder a % b, and remove the originals; compute the…
General practice
Given an undirected graph and a set of initially infected nodes, choose one initial node to remove so that the eventual malware spread across connected…
Companies: Zomato
Array · Breadth-First Search · Depth-First Search · Graph Theory
Given an undirected graph and a set of initially infected nodes, remove exactly one initial node to minimize the final number of infected nodes after…
General practice
Given N points on the plane, remove exactly one point to minimize the maximum Manhattan distance between any two remaining points. The challenge is to…
General practice
Partition a connected weighted graph by removing edges so you have at most k components and the cost (max edge weight) of each component is…
General practice
You can repeatedly move one unit from any element to its immediate left neighbor; find the smallest possible value of the array's maximum after any…
General practice
Given an even-length array, pair up its elements into n/2 disjoint pairs to minimize the largest pair sum and return that minimized maximum. This is…
General practice
Given an m×n grid of nonnegative integers and rules that let you redistribute values between neighboring cells, compute the smallest possible value of the largest…
General practice