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–25
Given a nested list of integers, compute the sum where each integer is weighted by the reverse of its depth (elements deeper in the nesting…
Companies: LinkedIn, Meta
Breadth-First Search · Depth-First Search · Stack
Last reported Oct 2026
Evaluate a valid arithmetic expression string containing non-negative integers and the operators +, -, *, / (with spaces allowed), where division truncates toward zero. The…
Companies: Anduril, Flex, Meta, Snap +1
Math · Stack · String
Last reported Oct 2026
Design a stack data structure that supports standard push, pop, and top operations, along with a getMax operation that retrieves (but does not remove) the…
Companies: Confluent, Everpure, LinkedIn, Walmart Labs
Design · Doubly-Linked List · Linked List · Ordered Set
Last reported Oct 2026
Given an array of non-negative heights representing elevation bars of width 1, compute the total units of water that can be trapped between them after…
Companies: Amazon, Bloomberg, Goldman Sachs, Google +6
Array · Dynamic Programming · Monotonic Stack · Stack
Last reported Oct 2026
Given a string s and integer k, repeatedly remove any run of k equal adjacent characters until no more removals are possible and return the…
Companies: Amazon, Apple, Meta, Oracle +2
Stack · String
Last reported Sep 2026
Given an absolute Unix-style path, produce its canonical simplified form by collapsing multiple slashes and resolving "." (current dir) and ".." (parent dir) references. This…
Companies: Meta, NVIDIA, Roblox, Snowflake
Stack · String
Last reported Sep 2026
Given a BST, a real-valued target and an integer k, return the k node values in the tree closest to the target. The challenge is…
Companies: Amazon, LinkedIn
Binary Search Tree · Binary Tree · Depth-First Search · Heap (Priority Queue)
Last reported Sep 2026
Decode a string containing nested repeat patterns of the form k[encoded_string], expanding each bracketed segment k times (k may be multi-digit) possibly with multiple nesting…
Companies: Bloomberg, Coupang, Google, Microsoft +4
Recursion · Stack · String
Last reported Aug 2026
For each price, compute the final cost as price minus the first subsequent price to its right that is <= it (or the same price…
Companies: Uber, Walmart
Array · Monotonic Stack · Stack
Last reported Aug 2026
Given a nested list where elements may be integers or sublists, implement a NestedIterator with next() and hasNext() that returns all integers in depth‑first, left‑to‑right…
Companies: Adobe, LinkedIn
Depth-First Search · Design · Iterator · Queue
Last reported Aug 2026
Check whether a string of parentheses/brackets is valid by ensuring every closing bracket matches the most recent unmatched opening bracket and the types and nesting…
Companies: Amazon, Apple, Bloomberg, Google +9
Bracket Sequences · Stack · String
Last reported Aug 2026
Determine whether a string containing '(', ')', and '*' (where '*' can represent '(', ')', or empty) can be assigned so the parentheses are balanced…
Companies: Apple, Microsoft, Oracle
Bracket Sequences · Dynamic Programming · Greedy · Stack
Last reported Jul 2026
Design a stack supporting push, pop, top, and getMin operations all in O(1) time. The core challenge is to maintain and update the current minimum…
Companies: Expedia, Snowflake
Design · Stack
Last reported Jun 2026
Given nums1 as a subset of nums2, for each element in nums1 return the first greater element that appears to its right in nums2 (or…
Companies: Flipkart, Microsoft
Array · Hash Table · Monotonic Stack · Stack
Last reported Jun 2026
Companies: eBay, Meta, Microsoft
Linked List · Recursion · Stack · Two Pointers
Last reported May 2026
Evaluate a string arithmetic expression containing integers, +, -, *, /, parentheses and unary signs, respecting operator precedence and parentheses. The challenge is to parse…
Companies: Google, Intuit, Meta
Math · Recursion · Stack · String
Last reported May 2026
Find the length of the longest well-formed (balanced) parentheses substring in a string of '(' and ')', handling nested and adjacent valid segments; this typically…
Companies: Amazon, Meta, Microsoft, Uber
Bracket Sequences · Dynamic Programming · Stack · String
Last reported Apr 2026
Implement a BrowserHistory class that supports visiting URLs (which clears any forward history), moving back or forward up to a specified number of steps, and…
Companies: Amazon, Bloomberg, Chime
Array · Data Stream · Design · Doubly-Linked List
Last reported Apr 2026
Given an array of building heights, return the indices of buildings that have an unobstructed view to the ocean on the right (i.e., no building…
Companies: Anduril, Meta
Array · Monotonic Stack · Stack
Last reported Apr 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 a valid parentheses string, compute its maximum nesting depth — the largest number of parentheses that are open at the same time. (Equivalent to…
Companies: Meta, Rippling
Bracket Sequences · Stack · String
Last reported Feb 2026
Given a string of '(' and ')', return the minimum number of parentheses insertions needed to make the string valid. This is solved greedily by…
Companies: Meta, Microsoft
Bracket Sequences · Greedy · Stack · String
Last reported Dec 2025
Choose heights within [1, maxHeights[i]] that form a mountain (nondecreasing to a single peak then nonincreasing) to maximize the total sum. Core challenge: for each…
Companies: Bloomberg, Expedia
Array · Monotonic Stack · Stack
Last reported Sep 2025
Return the node values of a binary tree in inorder (left → root → right) sequence. The recursive solution is trivial; the follow-up asks for…
Companies: Anduril, Meta, Oracle
Binary Tree · Depth-First Search · Stack · Tree
Last reported Jul 2025
Companies: Meta, Pinterest
Linked List · Math · Stack
Last reported May 2025