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 301–325
Given an array of positive integers (bag counts), remove beans (only deletions allowed) so that every non-empty bag has the same count, minimizing total beans…
Companies: D. E. Shaw
Array · Enumeration · Greedy · Prefix Sum
Count the number of index pairs (i, j) with 0 ≤ i < j < n such that nums[i] > 2 * nums[j]; this is…
Companies: eBay
Array · Binary Indexed Tree · Binary Search · Divide and Conquer
Given lists of positive and negative words and one feedback report per student, compute each student's score (+3 per positive word, -1 per negative word)…
Companies: Booking.com
Array · Hash Table · Heap (Priority Queue) · Sorting
Given inventories where each sale of a color yields value equal to its current count and reduces that count by one, choose which balls to…
Companies: Goldman Sachs
Array · Binary Search · Greedy · Heap (Priority Queue)
Given an array nums of length 2n structured as [x1,...,xn,y1,...,yn], return a new array that interleaves the two halves into [x1,y1,x2,y2,...,xn,yn].
Companies: Microsoft
Array
Companies: Amazon, Bloomberg, Google, Microsoft
Array · Hash Table
Companies: Nagarro
Array · Counting · Hash Table
Companies: Bloomberg, Google, Microsoft
Array · Prefix Sum
Given up to 16 required skills and up to 60 people each with some skills, find the smallest set of people whose combined skills cover…
Companies: Airbnb
Array · Bit Manipulation · Bitmask · Dynamic Programming
Treat the boustrophedon-labeled board as a 1D graph of squares where from any square you can move 1–6 steps (dice roll), but landing on a…
Companies: Tesla
Array · Breadth-First Search · Matrix
Companies: Amazon, Microsoft
Array · Hash Table · Prefix Sum
Count the number of contiguous subarrays whose sum is divisible by k; this reduces to counting pairs of prefix sums with the same remainder modulo…
Companies: TikTok
Array · Hash Table · Prefix Sum
Companies: Amazon, Bloomberg, Google, Microsoft
Array · Math · Number Theory · Simulation
Given an n×n zero matrix and queries that set entire rows or columns (overwriting previous values), compute the final matrix sum. Because later updates override…
Companies: Salesforce
Array · Hash Table
Companies: Amazon, Google, Meesho
Array · Counting · Depth-First Search · Hash Table
Companies: Amazon, Bloomberg
Array · Enumeration · Math · Sorting
Given a 1-indexed integer array nums of length n, compute the sum of squares of all elements at indices i that divide n (i.e., n…
Companies: Bloomberg
Array · Enumeration
Given an array of nonnegative integers, compute the sum of Hamming distances over all pairs of numbers. Key idea: for each bit position, count how…
Companies: Apple
Array · Bit Manipulation · Math
Companies: Amazon
Array · Depth-First Search · Tree