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,701–3,725
Choose index-wise swaps (swap nums1[i] with nums2[i]) so that after all operations nums1[n-1] and nums2[n-1] become the maximum values of their respective arrays, minimizing…
General practice
Given n, you may add or subtract any power of two per operation; find the minimum number of such operations to reach 0. The core…
Companies: Salesforce, Uber
Bit Manipulation · Dynamic Programming · Greedy
Remove elements from either end to make the sum of removed elements equal x; equivalently, find the longest contiguous subarray whose sum equals total(nums) -…
Companies: Bloomberg
Array · Binary Search · Hash Table · Prefix Sum
Given an m×n binary matrix, you can remove ones using operations that delete adjacent 1s (per the problem's adjacency rules); compute the minimum number of…
General practice
Companies: Google
Array · Binary Search · Math · Number Theory
Given a lowercase string s where one operation increments every occurrence of a chosen character to the next letter (with z→a), find the minimum operations…
General practice
Given an odd n x n grid with values 0–2, find the minimum number of single-cell changes needed so that all cells on the letter…
General practice
Given an array where the only allowed operation is to replace the leftmost adjacent pair that has the minimum sum with their sum, determine the…
General practice
Given an array, repeatedly merge the leftmost adjacent pair with the minimum sum by replacing it with their sum; compute the minimum number of such…
General practice
You must navigate and discover a hidden grid using only local movement/cost queries from a start cell, reconstructing reachable cells and obstacles as you explore…
General practice
Given a string of 'Y'/'N' arrivals, choose an index j (0..n) to close the shop so that open hours with 'N' and closed hours with…
General practice
Find the smallest positive sum of any contiguous subarray whose length is between l and r (inclusive). This reduces to scanning prefix sums and for…
General practice
Given a digit string and a budget k of adjacent swaps, produce the lexicographically smallest string obtainable by performing at most k adjacent swaps. The…
General practice
Companies: General Motors
Array · Dynamic Programming · Memoization