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,676–3,700
Given n and the array arr[i]=2*i+1, compute the minimum number of unit transfers (subtract 1 from one element and add 1 to another) required to…
General practice
Determine if you can transform nums1 into nums2 by repeatedly transferring value k from one index to another (which preserves total sum and requires each…
General practice
Given two equal-length arrays, find the minimum number of operations that add or subtract 1 to every element of any chosen contiguous subarray to turn…
General practice
Companies: Amazon
Array · Greedy
Find the minimum number of single-unit decrements (each replaces nums[i] with nums[i]-1) needed to make the array sum divisible by k — since each operation…
General practice
Given an array and a target k, you may repeatedly pick a valid h (all elements > h must be identical) and set those elements…
General practice
Given a binary array, find the minimum number of operations that flip any 3 consecutive bits so that all elements become 1, or return -1…
General practice
Given a binary array where an operation toggles all elements from some chosen index to the end, find the minimum number of such suffix-flip operations…
General practice
Companies: Teradata
Array · Binary Search · Bit Manipulation · Two Pointers
Given a lowercase string s, compute the minimum number of operations (delete, insert, or change a character to its next alphabet letter — no wrap…
General practice
Given an m x n grid of nonnegative integers where you may increment any cell by 1, compute the minimum total increments needed so that…
General practice
Compute for each length-x window the minimum L1 cost to make all its elements equal (choose the median), then pick k non-overlapping windows with minimum…
General practice
Companies: Google
Array · Binary Search
Find the minimum number of ±1 operations to make the array's median equal to k. After sorting, only elements on the median side that lie…
General practice
Given an array of integers, compute the minimum number of allowed reduction operations needed to make every element non‑positive (≤ 0) — where each operation…
General practice
Given an integer array and a target subarray length k, find the minimum number of ±1 operations needed to make all elements of some contiguous…
General practice
Choose one value for all even indices and another (different) value for all odd indices so the array satisfies equal values by parity and adjacent…
General practice
Compute the minimum number of +1 operations to make an integer array strictly increasing; the optimal solution is a left-to-right greedy scan that raises any…
General practice
Partition the array into k independent subsequences of indices i, i+k, i+2k, ...; each subsequence must be non-decreasing for the array to be K-increasing, so…
General practice
Given num1 and num2, you may repeatedly subtract values of the form 2^i + num2 (i in [0,60]); find the minimum number of such operations…
General practice