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,201–3,225
Given batchSize and group sizes, maximize how many groups can start with a fresh batch by reordering groups; the core challenge is to treat group…
General practice
Given counts usageLimits[i] for distinct elements i, pack elements into the maximum number of groups such that each group has distinct elements, group sizes are…
General practice
Given a banned set, n, and maxSum, pick the maximum number of distinct integers from 1..n (excluding banned values) whose total sum does not exceed…
General practice
Given an inclusive integer range and a collection of forbidden numbers or intervals, determine the maximum count of integers you can choose from that range…
General practice
Companies: Microsoft
Array · Dynamic Programming · Greedy
Given nums and target, you may jump from i to any j>i if nums[j]-nums[i] lies in [-target, target]; compute the maximum number of jumps to…
General practice
Partition a tree by removing edges so every resulting component's node-sum is divisible by k, and return the maximum number of components. The core challenge…
General practice
Given two equal-length arrays (or strings), find the circular right-shift of one array that maximizes the number of indices where the shifted array equals the…
General practice
Given an m x n grid of positive integers, you may start at any cell in the first column and move only to the right-up…
General practice
Players alternately choose and capture a remaining pawn with the knight using the minimal number of knight moves from its current position, where Alice aims…
General practice
Given a string s and integer k, choose the maximum number of non-overlapping substrings each of which is a palindrome of length at least k…
General practice
Given an array nums and a target, find the maximum number of non-overlapping contiguous subarrays whose sums equal target. The core challenge is detecting subarray…
General practice
For each character, determine the smallest substring that contains all occurrences of that character (and thus any characters inside it), producing candidate intervals; then…
General practice
Given a binary matrix and a set of allowed operations or placement constraints (e.g., flipping rows/columns, selecting submatrices, or placing up to k ones), choose…
General practice
Given a binary string s, you may repeatedly pick any adjacent "10" and slide that '1' rightward over all following zeros until it hits another…
General practice
Given an array, pick a target score S and repeatedly remove disjoint pairs of elements whose sums equal S; return the maximum number of such…
General practice
Given an array where you may repeatedly remove either the first two, the last two, or the first and last elements, maximize how many such…
General practice
Given an integer array, repeatedly remove equal-valued pairs and return [number_of_pairs, leftover_count]. This reduces to counting frequencies and summing floor(freq/2) for…
General practice
Given rules for which people can tag which others (based on positions, times, or movement constraints), compute the largest number of people that can be…
General practice
Choose one cell per row to maximize the sum of cell values minus the absolute column-distance cost between consecutive rows; the core challenge is computing…
General practice
Given positions and repair costs for potholes along a road and a limited time or budget, determine the maximum number you can fix while accounting…
General practice
Given strings s and p and an ordered list of removable indices, find the maximum k such that after deleting the first k indices from…
General practice
Given an array (or similar structure) and a sequence of removal queries, determine the largest prefix of queries that can be applied while preserving a…
General practice
Find the maximum length of a contiguous subarray (consecutive robots) such that max(chargeTimes in the window) + window_length * sum(runningCosts in the window) <= budget…
General practice