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,126–3,150
Given a map with coin values and multiple heroes that can move under specific step/time or path constraints, compute the maximum total coins collectible by…
General practice
Given m students and m mentors each with n-bit binary answer vectors, compute pairwise compatibility scores (count of equal bits) and choose a one-to-one assignment…
General practice
Given bottom, top, and a list of special floors, find the longest consecutive run of floors within [bottom, top] that contains no special floor. Sort…
General practice
Companies: Amazon
Array · Dynamic Programming · Matrix
Given an n x n deck where each cell can hold one container of weight w, return the maximum number of containers you can load…
General practice
Given a non-decreasing sorted array, return the larger of the counts of positive and negative numbers (zeros are ignored). Because the array is sorted, you…
General practice
Given a string s, repeatedly either delete the whole string or delete a prefix of length i when the first i characters equal the next…
General practice
Given a circular integer array, compute the maximum absolute difference between any pair of adjacent elements, treating the first and last elements as adjacent.
General practice
Given a lowercase string, compute character frequencies and return the maximum possible difference freq(a1) - freq(a2) where a1 has an odd frequency and a2 has…
General practice
Find the maximum value of freq[a] - freq[b] over all substrings of length ≥ k of a string (digits '0'–'4'), subject to character a having…
General practice
Find the maximum positive difference nums[j] - nums[i] with i < j and nums[i] < nums[j] in an array, returning -1 if no such increasing…
General practice
Given a binary tree, find the maximum absolute difference |a.val - b.val| over all pairs where a is an ancestor of b. This reduces to…
General practice
Given an integer, you may globally remap one digit (replace all occurrences of a chosen digit with another digit); compute the maximum and minimum integers…
General practice
Given an m x n grid where you can jump any distance only to the right or down and each move scores destination − source…
General practice
Given two non-increasing arrays, find the maximum index distance j - i for a pair (i, j) with i <= j and nums1[i] <= nums2[j]…
General practice
Companies: Walmart Labs
Array · String
Given m sorted arrays, pick one element from two different arrays to maximize the absolute difference |a - b|; because each array is sorted, only…
General practice
Choose a set of non-overlapping rides (you travel one-way and carry at most one passenger) to maximize total profit, where each ride's profit = end…
General practice
Select exactly k items (each with profit and category) to maximize total_profit + (number_of_distinct_categories)^2, requiring a trade-off between picking highest-profit items…
General practice
You can reorder and decrease array elements so the first element is 1 and every adjacent difference is at most 1; return the largest possible…
General practice
Partition indices by their square-free kernel (i.e., remove all square factors from each index) since i*j is a perfect square iff the two indices share…
General practice
Given a functional directed graph where each node points to its favorite person, choose the largest subset that can be arranged around a round table…
General practice
Find the maximum number of consecutive enemy forts (0s) that can be captured by moving an army from one of your forts (1) to an…
General practice