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 51–75
Count the number of contiguous, non-empty subarrays whose elements sum to k. Because nums can include negatives (so two-pointer sliding window doesn't work), use cumulative…
Companies: Amazon, Apple, Bloomberg, Google +3
Array · Hash Table · Prefix Sum
Last reported Mar 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 a binary tree and a target node value, return all node values at distance K from the target. The challenge is to traverse both…
Companies: Amazon, Meta, Microsoft, TikTok
Binary Tree · Breadth-First Search · Depth-First Search · Hash Table
Last reported Mar 2026
Given recipes whose ingredients may include other recipes and an initial set of supplies, determine which recipes can be produced; the core challenge is dependency…
Companies: Amazon, Google, Tesla
Array · Directed Acyclic Graph · Graph Theory · Hash Table
Last reported Feb 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
Manage tokens that expire timeToLive seconds after creation/renewal, supporting generate, renew (only if the token is still unexpired), and countUnexpiredTokens (with…
Companies: Adobe, OpenAI
Design · Doubly-Linked List · Hash Table · Linked List
Last reported Feb 2026
Simulate a robot on an infinite grid executing turn commands and unit-step moves, stopping any step that would hit an obstacle and updating its facing…
Companies: Apple, Meta, Shopify
Array · Hash Table · Simulation
Last reported Feb 2026
Given a binary tree and a start node, compute how many minutes it takes for an infection that spreads each minute to adjacent nodes (parent/children)…
Companies: Microsoft, Salesforce
Binary Tree · Breadth-First Search · Depth-First Search · Hash Table
Last reported Dec 2025
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
Rearrange the characters of a string so that no two adjacent characters are the same, returning any valid permutation or "" if none exists. Key…
Companies: Amazon, D. E. Shaw, Tesla
Counting · Greedy · Hash Table · Heap (Priority Queue)
Last reported Jan 2025
Given up to 300 unique 2D points, return the maximum number that lie on the same straight line. The core challenge is grouping points by…
Companies: Google, LinkedIn
Array · Euclidean Algorithm · Geometry · Greatest Common Divisor
Last reported Jan 2025
Return true if any integer appears at least twice in the array and false if all elements are distinct. Array length can be up to…
Companies: Google, Meta
Array · Hash Table · Sorting
Last reported Oct 2024
Given a string and allowed index swap pairs, view pairs as edges in a graph to find connected components where characters can be freely permuted…
Companies: Goldman Sachs, Google
Array · Breadth-First Search · Depth-First Search · Hash Table
Last reported Oct 2024
Maintain dynamic collections to (1) return the cheapest up-to-5 shops that have an unrented copy of a given movie and (2) report the cheapest up-to-5…
Companies: Amazon, Okta
Array · Design · Hash Table · Heap (Priority Queue)
Last reported Sep 2024
Convert each target letter to its board coordinates and output a shortest sequence of moves (U/D/L/R) plus '!' to spell the string by walking between…
Companies: Atlassian
Hash Table · String
Assign dry operations on zero days so that no lake is rained on while already full: given a sequence where rains[i]>0 fills a lake and…
Companies: MongoDB
Array · Binary Search · Greedy · Hash Table
Find the maximum length of a contiguous subarray in a binary array that contains an equal number of 0s and 1s. This is solved by…
Companies: Cisco
Array · Hash Table · Prefix Sum
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
Count pairs of nodes in a rooted tree whose path edge-letters can be rearranged into a palindrome — equivalently, the multiset of letters on the…
Companies: Goldman Sachs
Bit Manipulation · Depth-First Search · Hash Table · Tree
Count the number of contiguous substrings that consist only of vowels and contain all five vowels (a, e, i, o, u) at least once. The…
Companies: D. E. Shaw, Expedia, Salesforce, Snowflake
Hash Table · String
Companies: Rippling
Data Stream · Design · Hash Table · Queue
Implement an Encrypter that maps each character to a two-letter code and supports encrypting by replacing characters and decrypting by counting how many dictionary words…
Companies: Duolingo
Array · Design · Hash Table · String
Find all integers that occur exactly once in nums and whose immediate neighbors (x-1 and x+1) do not appear in the array; return these "lonely"…
Companies: Apple
Array · Counting · Hash Table
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
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