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–17
Given an array of words and a maximum line width maxWidth, format the text so that each line has exactly maxWidth characters and is fully…
Companies: Airbnb, Amazon, Anyscale, Capital One +3
Array · Simulation · String
Last reported Nov 2026
Traverse the m×n matrix in clockwise spiral order (right, down, left, up) and return the elements in that sequence. The core challenge is managing changing…
Companies: Capital One, Liveramp, Meta, Microsoft +1
Array · Matrix · Simulation
Last reported Sep 2026
Simulate batched buy/sell order matching where each buy matches with the lowest-price sell (and each sell with the highest-price buy), allowing partial fills until no…
Companies: Amazon, Citadel
Array · Heap (Priority Queue) · Simulation
Last reported Aug 2026
Design an allocator for n memory units that supports allocating the leftmost contiguous block of a given size and freeing all units with a given…
Companies: Apple, OpenAI, Roblox
Array · Design · Hash Table · Simulation
Last reported Jul 2026
Assign each meeting (with unique start times) to the lowest-numbered available room or delay it (keeping its duration and prioritizing earlier original start times) until…
Companies: Apple, Docusign, Google, Meta +2
Array · Hash Table · Heap (Priority Queue) · Simulation
Last reported Jul 2026
Given a binary string where every second all occurrences of "01" simultaneously become "10", determine how many seconds until no "01" remains; the core challenge…
Companies: Salesforce
Dynamic Programming · Simulation · String
Last reported Jun 2026
Given sorted tax brackets with upper bounds and percentages, compute the progressive tax on a given income by summing, for each bracket in order, the…
Companies: Bloomberg, Gusto, Snowflake
Array · Simulation
Last reported May 2026
Given signed integers for asteroid sizes and directions, determine which asteroids remain after sequential collisions where only opposite-moving neighbors (positive then…
Companies: Amazon, D. E. Shaw, JPMorgan Chase, Meta +2
Array · Simulation · Stack
Last reported Mar 2026
Given an m×n board of integer "candies," repeatedly find and remove any horizontal or vertical runs of ≥3 identical candies, let the remaining candies fall…
Companies: Meta, Microsoft, Roblox
Array · Matrix · Simulation · Two Pointers
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
Multiply two non-negative integer strings without converting them to numeric types or using BigInteger: compute the product by simulating grade-school digit-by-digit…
Companies: Meta, Microsoft, Pinterest
Math · Simulation · String
Last reported Sep 2025
Given an array of distinct integers, repeatedly compare the first two elements, keeping the larger at the front and moving the smaller to the back…
Companies: Amazon, Goldman Sachs
Array · Simulation
Last reported Sep 2025
Simulate days on an m×n grid where infected cells spread 4-directionally: each day identify all connected infected regions, compute for each the set of uninfected…
Companies: Flipkart, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Jan 2025
Add two binary strings and return their sum as a binary string by performing digit-wise addition from the least significant bit with carry, handling unequal…
Companies: Meta
Bit Manipulation · Math · Simulation · String
Given an integer array nums, produce ans by concatenating nums with itself so that ans has length 2n and ans[i]=nums[i], ans[i+n]=nums[i] for 0<=i<n; this is…
Companies: Bloomberg, Google
Array · Simulation
Given n people seated in a circle, repeatedly remove every k-th person clockwise until one remains and return their label — the classic Josephus problem…
Companies: Goldman Sachs
Array · Math · Queue · Recursion
Implement a read(n) method using the provided read4(buf) API where read may be called multiple times; you must preserve and reuse leftover characters between calls…
Companies: Lyft, NVIDIA
Array · Interactive · Simulation