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 1–23
Find the maximum total sum of two non-overlapping contiguous subarrays of given lengths firstLen and secondLen (either order allowed). Typical approach uses prefix sums or…
Companies: Meta, Sprinklr
Array · Dynamic Programming · Sliding Window
Last reported Oct 2026
Find the length of the longest contiguous substring that contains no repeated characters. This is a classic sliding-window / two-pointer problem where you track seen…
Companies: Amazon, Apple, Autodesk, Bloomberg +12
Hash Table · Sliding Window · String
Last reported Oct 2026
Given non-overlapping segments where every integer position in [li, ri] holds ci coins, find the maximum total coins covered by any contiguous window of k…
Companies: Amazon
Array · Binary Search · Greedy · Prefix Sum
Last reported Oct 2026
Count the number of contiguous subarrays of positive integers whose product is strictly less than k. Because all nums > 0, this is a sliding-window/two-pointer…
Companies: Apple
Array · Binary Search · Prefix Sum · Sliding Window
Last reported Oct 2026
Find the maximum length of a contiguous subarray that can be made all 1s by flipping at most k zeros — equivalently, find the longest…
Companies: Amazon, D. E. Shaw, LinkedIn, Meta
Array · Binary Search · Prefix Sum · Sliding Window
Last reported Sep 2026
Find the smallest substring of s that contains all characters of t (including duplicates), or return "" if none exists. This is typically solved with…
Companies: Amazon, LinkedIn, Lyft, Meta +2
Hash Table · Sliding Window · String
Last reported Sep 2026
Find the substring (overlaps allowed) that occurs most often in s among those with length between minSize and maxSize and at most maxLetters distinct characters…
Companies: Chewy, LinkedIn, Microsoft
Hash Table · Sliding Window · String
Last reported Aug 2026
Given an integer array and a window size k, return the maximum value for each contiguous subarray (sliding window) as it moves one step to…
Companies: Amazon, Bloomberg, D. E. Shaw, Expedia +7
Array · Heap (Priority Queue) · Monotonic Queue · Queue
Last reported Jun 2026
Given a string and an integer K, find the length of the longest substring that contains at most K distinct characters. This is typically solved…
Companies: LinkedIn, TikTok
Hash Table · Sliding Window · String
Last reported Apr 2026
Find the length of the longest contiguous subarray whose maximum minus minimum is ≤ limit; the key challenge is maintaining the window's current min and…
Companies: MongoDB, Uber
Array · Heap (Priority Queue) · Monotonic Queue · Ordered Set
Last reported Apr 2026
Count the number of contiguous subarrays whose minimum equals minK and maximum equals maxK. The main challenge is to efficiently (O(n)) scan the array, partitioning…
Companies: Adobe, Uber
Array · Monotonic Queue · Queue · Sliding Window
Last reported Apr 2026
Check whether any substring of s2 of length |s1| is a permutation of s1 (i.e., has the same character multiset). The core challenge is to…
Companies: Apple, Meta
Hash Table · Sliding Window · String · Two Pointers
Last reported Mar 2026
Given strings s and p, return all start indices of substrings in s that are anagrams of p; the core challenge is to detect equal…
Companies: Amazon, Databricks, Microsoft
Hash Table · Sliding Window · String
Last reported Feb 2026
Find the length of the longest substring that can be turned into all the same letter by performing at most k character replacements; this is…
Companies: D. E. Shaw, Goldman Sachs, Meta, Microsoft +1
Hash Table · Sliding Window · String
Last reported Oct 2025
Find the length of the shortest contiguous subarray of positive integers whose sum is at least a given target (return 0 if none exists). This…
Companies: Bloomberg, Meta, Toast
Array · Binary Search · Prefix Sum · Sliding Window
Last reported Aug 2025
Find the length of the shortest contiguous subarray whose sum is at least k, or return -1 if none exists. Because nums can contain negative…
Companies: Meta
Array · Binary Search · Heap (Priority Queue) · Monotonic Queue
Last reported Jan 2025
Given a circular binary array and integer k, count how many contiguous length-k segments are alternating (every adjacent pair within the segment differs). Because of…
Companies: eBay
Array · Sliding Window
Count the number of contiguous subarrays that contain exactly k odd numbers in an integer array. The core challenge is to do this in linear…
Companies: TikTok
Array · Hash Table · Math · Prefix Sum
Given an array of fruit types where you can pick from a contiguous sequence while carrying at most two distinct types (two baskets), return the…
Companies: Adobe, Amazon, Meta, Salesforce
Array · Hash Table · Sliding Window
Find the length of the longest contiguous substring made only of vowels that contains each of 'a','e','i','o','u' at least once and whose characters never decrease…
Companies: Rippling
Sliding Window · String
Convert each point to its polar angle around your location (counting points at the exact location separately), sort these angles and handle the circular wrap…
Companies: Anduril
Array · Geometry · Math · Sliding Window
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 nums and k, remove the fewest elements so the remaining array has max ≤ k * min. Equivalently, find the largest subset of numbers…
Companies: Salesforce
Array · Binary Search · Sliding Window · Sorting