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 201–225
Companies: Amazon, Infosys
Array · Math · Number Theory · Segment Tree
Given positions of houses and heaters on a line, find the minimum uniform radius R such that every house is within distance R of some…
Companies: Anduril
Array · Binary Search · Sorting · Two Pointers
Given a list of (studentId, score) pairs, compute each student's average of their top five scores and return the results as (studentId, average) sorted by…
Companies: Goldman Sachs
Array · Hash Table · Heap (Priority Queue) · Sorting
Companies: Google, Meta
Array · Math · Number Theory
Find the maximum area of a rectangle formed by contiguous bars in a histogram (given bar heights). The core challenge is determining each bar's maximal…
Companies: Bloomberg, Microsoft
Array · Monotonic Stack · Range Minimum/Maximum Query · Stack
Given an array of stone weights, repeatedly take the two heaviest stones, remove them, and if their weights differ push back the difference; return the…
Companies: Apple, Salesforce
Array · Heap (Priority Queue)
Split the stones into two groups to minimize the absolute difference of their total weights — equivalent to finding the largest subset sum ≤ total_sum/2…
Companies: Apple
0-1 Knapsack · Array · Dynamic Programming · Knapsack Problem
Companies: Media.net
Array · Bit Manipulation · Greedy
Companies: Amazon, BNY Mellon, InMobi, Tekion
Array · Greedy · Hash Table · Queue
Companies: Amazon
Array · Greedy · Math · Sorting
Companies: Amazon
Array · Enumeration
Companies: Amazon, Bloomberg, Google, Intuit
Array · Divide and Conquer · Hash Table · Prefix Sum
Companies: Amazon, Google
Array · Divide and Conquer · Hash Table · Prefix Sum
Given an array of integers, return the length of the longest strictly increasing subsequence; the core challenge is to compute this efficiently—naive DP is O(n^2)…
Companies: PayPal
Array · Binary Search · Dynamic Programming · Longest Increasing Subsequence
Companies: Google
Array · Dynamic Programming
Companies: Amazon
Array · Hash Table · Prefix Sum
Companies: Bloomberg, Google, Infosys
Array · Bit Manipulation
Given an acyclic directed graph of richer->poorer relations and a quietness score per person, compute for each person the quietest person among all people who…
Companies: Flipkart
Array · Depth-First Search · Directed Acyclic Graph · Graph Theory
You may swap two indices iff their values differ by at most limit; compute the lexicographically smallest array obtainable by any sequence of such swaps…
Companies: Goldman Sachs, Uber
Array · Sorting · Union-Find
Companies: Google
Array · Greedy · Sorting · Union-Find
Companies: Amazon, Google
Array · Dynamic Programming
Given a binary array where 1s are occupied seats, find an empty seat that maximizes the distance to the nearest occupied seat. The core challenge…
Companies: Adobe, Roblox
Array
Companies: Amazon
Array · Binary Search · Sorting
Companies: Amazon
Array · Binary Search · Dynamic Programming · Sorting