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,276–3,300
Determine the maximum time T such that, with unlimited instantaneous swapping of batteries, you can allocate battery minutes to run n computers simultaneously — equivalently…
General practice
Select a subset of nodes in a rooted tree to collect their positive values (setting them to zero) to maximize total collected value subject to…
General practice
Companies: Amazon
Array · Greedy · Heap (Priority Queue) · String
Given a binary string, choose a split into two non-empty substrings to maximize the sum of zeros in the left part and ones in the…
General practice
Choose, for each column, a prefix length of rows to color black (turning rows 0..i black in that column); a white cell (i,j) contributes grid[i][j]…
General practice
Pick exactly m elements from either end of nums in order, adding multipliers[i] * chosen_value each step, to maximize the total score. The core challenge…
General practice
Given three piles, maximize the number of turns removing one stone from two different non-empty piles; the core challenge is optimally pairing stones until either…
General practice
Given a string s and scores x and y for removing substrings "ab" and "ba", repeatedly delete those substrings to maximize total points. Because deletions…
General practice
Find the maximum value of min(nums[i..j]) * (j - i + 1) over all subarrays [i, j] that contain index k — i.e., the largest…
General practice
Given an undirected graph with node scores, find the maximum sum of scores of any simple path of exactly four nodes (a–b–c–d with edges between…
General practice
Given weighted intervals (sharing endpoints counts as overlapping), select up to four pairwise non-overlapping intervals that maximize the total weight and return the…
General practice
Given two equal-length arrays where you may swap at most one contiguous subarray between them, maximize the larger of the two arrays' sums after the…
General practice
Companies: Atlassian
Array · Combinatorics · Enumeration · Hash Table
Given a list of words, a multiset of available letters, and per-letter scores, select a subset of words (each used at most once) whose combined…
General practice
Given an array and an order of index removals that zero out elements and split the array into contiguous positive segments, return the maximum segment…
General practice
Find the largest side length k such that there exists a k×k submatrix with sum ≤ threshold; typical approaches use 2D prefix sums to query…
General practice
Choose n/2 elements to keep from each of two equal-length arrays so that the union of the remaining elements has maximum distinct values. The task…
General practice
Given an array and rules that restrict which elements can coexist, determine the largest possible final array (subsequence or multiset) you can obtain by removing…
General practice
Given m shops each represented by a non-increasing list of n item values, you repeatedly pick the current rightmost (smallest remaining) item from any shop…
General practice
Given finalSum, produce a list of unique positive even integers that sum to finalSum and has the maximum possible count (or return empty if no…
General practice
Given positions of removable interior horizontal and vertical fences (with the outer borders fixed), choose two horizontal and two vertical lines (removing others) so the…
General practice
For each node, choose up to k neighbors with the largest values (excluding negative contributions) and compute the star sum as the node's value plus…
General practice
Pick a non-empty subset of the given array (n ≤ 13) to maximize the product; the core challenge is handling signs and zeros—pairing negatives, keeping…
General practice