Skip to content
Jarviix
AI Interview Prep

Practice how to think, not just how to code.

Browse the catalog and open the focused workspace for any problem. Each session walks you through clarifying questions, reasoning, optimization trade-offs, and follow-ups — with an AI coach beside you.

253Problems75Easy154Medium24Hard
Your progress
0/253problems solved
0Solved0In progress253Todo
Topics(56)
Showing 253 of 253 problems

Two Sum

Find the two indices whose values add to a target.

Easy
ArrayHashing
25 minGoogle · Meta +2

Valid Anagram

Determine if one string is a permutation of another.

Easy
StringHashingSorting
20 minAmazon · Bloomberg +1

LRU Cache

Design a cache with O(1) get and put using LRU eviction.

Medium
Hash MapDoubly Linked ListDesign
45 minGoogle · Amazon +3

Course Schedule

Detect a cycle in a directed dependency graph.

Medium
GraphTopological SortBFS+1
35 minGoogle · Meta +2

Word Break

Can a string be segmented into dictionary words?

Medium
Dynamic ProgrammingTrieString
40 minMeta · Amazon +2

Number of Islands

Count connected components of land in a grid.

Medium
GridBFSDFS+1
30 minAmazon · Meta +2

Trapping Rain Water

How much water can be trapped between elevation bars?

Hard
Two PointersStackDynamic Programming
50 minGoogle · Amazon +2

Median of Two Sorted Arrays

Find the median of two sorted arrays in O(log(min(n, m))).

Hard
Binary SearchArrayDivide and Conquer
55 minGoogle · Apple +2

Best Time to Buy and Sell Stock

Find the maximum profit from a single buy-sell pair in a price series.

Easy
ArrayDynamic Programming
20 minAmazon · Meta +2

Maximum Subarray

Find the contiguous subarray with the largest sum (Kadane's algorithm).

Easy
ArrayDynamic ProgrammingDivide and Conquer
20 minAmazon · Microsoft +2

Climbing Stairs

Count the distinct ways to reach the top of an n-step staircase.

Easy
Dynamic ProgrammingMathMemoization
15 minAmazon · Adobe +1

Valid Parentheses

Decide whether a string of brackets is balanced.

Easy
StackString
15 minAmazon · Google +2

Contains Duplicate

Detect whether any value appears more than once in an array.

Easy
ArrayHashingSorting
10 minAmazon · Microsoft +1

Container With Most Water

Pick two vertical lines that, with the x-axis, hold the most water.

Medium
ArrayTwo PointersGreedy
25 minAmazon · Bloomberg +1

3Sum

Find all unique triplets in the array that sum to zero.

Medium
ArrayTwo PointersSorting
30 minAmazon · Meta +2

Longest Substring Without Repeating Characters

Find the length of the longest substring containing all unique characters.

Medium
StringSliding WindowHashing
25 minAmazon · Bloomberg +2

Top K Frequent Elements

Return the k most frequent elements from an integer array.

Medium
ArrayHashingHeap+1
25 minAmazon · Yelp +1

Product of Array Except Self

Return an array where output[i] is the product of every other element.

Medium
ArrayPrefix Sum
25 minAmazon · Meta +2

Merge Intervals

Merge all overlapping intervals and return the sorted, merged result.

Medium
ArraySortingIntervals
25 minAmazon · Meta +2

Search in Rotated Sorted Array

Find a target in a sorted array that has been rotated at an unknown pivot.

Medium
ArrayBinary Search
25 minAmazon · Meta +2

Coin Change

Find the fewest coins needed to make a target amount.

Medium
Dynamic ProgrammingArray
30 minAmazon · Goldman Sachs +1

House Robber

Maximize loot from a row of houses where adjacent houses can't both be robbed.

Medium
Dynamic ProgrammingArray
20 minAmazon · LinkedIn +1

Longest Palindromic Substring

Return the longest palindromic substring of s (expand-around-center).

Medium
StringDynamic ProgrammingTwo Pointers
30 minAmazon · Microsoft +2

Subsets

Generate all subsets (the power set) of a unique-integer array.

Medium
BacktrackingBit ManipulationArray
25 minAmazon · Meta +1

Decode Ways

Count how many ways a digit string can be decoded into letters A–Z.

Medium
Dynamic ProgrammingString
25 minMeta · Microsoft +1

Longest Increasing Subsequence

Find the length of the longest strictly increasing subsequence of nums.

Medium
Dynamic ProgrammingBinary Search
30 minAmazon · Microsoft +1

Edit Distance

Compute the minimum insert/delete/replace ops to convert word1 into word2.

Hard
Dynamic ProgrammingString
35 minGoogle · Amazon +2

Sliding Window Maximum

Return the maximum of every window of size k as it slides over nums.

Hard
ArrayDequeSliding Window+1
30 minAmazon · Google +1

Reverse Linked List

Reverse a singly linked list in place and return the new head.

Easy
Linked ListRecursion
15 minAmazon · Meta +3

Invert Binary Tree

Mirror every node's left/right children and return the new root.

Easy
TreeBinary TreeBFS+1
15 minGoogle · Amazon +2

Longest Consecutive Sequence

Find the length of the longest run of consecutive integers in O(n).

Medium
ArrayHashingUnion Find
25 minAmazon · Google +1

Missing Number

Given nums in [0, n] with one missing, return the missing number.

Easy
ArrayMathBit Manipulation
15 minAmazon · Microsoft +1

Single Number

Find the one element that appears once in an array where every other appears twice.

Easy
ArrayBit Manipulation
10 minAmazon · Apple +1

Majority Element

Find the element that appears more than ⌊n/2⌋ times (Boyer-Moore vote).

Easy
ArrayHashingDivide and Conquer
15 minAmazon · Adobe +1

Intersection of Two Arrays

Return unique values that appear in both arrays.

Easy
ArrayHashingTwo Pointers
15 minAmazon · Microsoft

Move Zeroes

Move all 0s to the end while preserving the relative order of non-zero elements.

Easy
ArrayTwo Pointers
10 minAmazon · Meta +2

Valid Sudoku

Determine if a partially filled 9×9 Sudoku board is valid.

Medium
ArrayHashingMatrix
20 minAmazon · Apple +1

Happy Number

Decide whether the squares-of-digits process eventually reaches 1.

Easy
MathHashingTwo Pointers
15 minAmazon · Bloomberg +1

Isomorphic Strings

Decide whether s and t are isomorphic via a consistent character mapping.

Easy
StringHashing
15 minAmazon · LinkedIn +1

Plus One

Increment a big integer represented as an array of digits.

Easy
ArrayMath
10 minGoogle · Amazon +1

Valid Palindrome

Decide if a string reads the same forwards and backwards (alphanumeric, case-insensitive).

Easy
Two PointersString
15 minMeta · Microsoft +1

Two Sum II — Input Array Is Sorted

Find two 1-indexed numbers in a sorted array that sum to target.

Medium
Two PointersBinary SearchArray
15 minAmazon · Bloomberg +1

Sort Colors

Sort an array of 0/1/2 values in a single pass (Dutch national flag).

Medium
ArrayTwo PointersSorting
20 minMicrosoft · Amazon +1

3Sum Closest

Return the sum of three integers closest to the target.

Medium
ArrayTwo PointersSorting
25 minAmazon · Bloomberg +1

Squares of a Sorted Array

Square each element of a sorted array; return the result in non-decreasing order.

Easy
ArrayTwo PointersSorting
15 minAmazon · Apple +1

Is Subsequence

Decide whether s appears as a subsequence of t.

Easy
StringTwo PointersDynamic Programming
10 minPinterest · Adobe +1

Backspace String Compare

Decide if two strings are equal after applying '#' as backspace.

Easy
Two PointersStackString
15 minGoogle · Facebook +1

Partition Labels

Split a string into the largest possible parts where every letter appears in only one part.

Medium
StringGreedyTwo Pointers+1
20 minAmazon · Microsoft

Boats to Save People

Pair the heaviest with the lightest; minimize boats given a weight limit.

Medium
GreedyTwo PointersSorting
20 minAmazon · Apple

Reverse String

Reverse a string.

Easy
StringTwo Pointers
5 minAmazon · Microsoft +1

Longest Repeating Character Replacement

Find the longest substring you can make uniform by changing at most k characters.

Medium
StringSliding WindowHashing
25 minGoogle · Amazon +1

Permutation in String

Decide whether s2 contains any permutation of s1 as a substring.

Medium
StringSliding WindowHashing
25 minMicrosoft · Amazon

Find All Anagrams in a String

Return all start indices of anagrams of p inside s.

Medium
StringSliding WindowHashing
25 minAmazon · Microsoft +1

Fruit Into Baskets

Longest contiguous subarray containing at most 2 distinct values.

Medium
ArraySliding WindowHashing
20 minGoogle · Amazon

Subarray Sum Equals K

Count contiguous subarrays whose sum equals k.

Medium
ArrayHashingPrefix Sum
25 minAmazon · Meta +1

Minimum Size Subarray Sum

Smallest contiguous subarray with sum ≥ target (positives only).

Medium
ArraySliding WindowBinary Search+1
25 minGoldman Sachs · Amazon +1

Maximum Number of Vowels in a Substring of Given Length

Maximum vowels within any window of length k.

Medium
StringSliding Window
15 minAmazon · Apple

Longest Substring with At Most K Distinct Characters

Longest substring containing no more than k distinct characters.

Medium
StringSliding WindowHashing
25 minGoogle · Facebook +1

Minimum Window Substring

Smallest window in s containing every character of t (with multiplicity).

Hard
StringSliding WindowHashing
35 minAmazon · Meta +1

Max Consecutive Ones

Length of the longest run of 1s in a binary array.

Easy
ArraySliding Window
5 minAmazon · Microsoft

Evaluate Reverse Polish Notation

Evaluate an arithmetic expression in postfix (RPN) notation.

Medium
StackMathArray
20 minAmazon · LinkedIn +1

Daily Temperatures

For each day, find how many days until a warmer temperature.

Medium
StackArrayMonotonic Stack
20 minAmazon · Bloomberg +1

Next Greater Element I

For each value in nums1, find its next greater value in nums2.

Easy
StackHashingArray+1
20 minAmazon · Bloomberg

Next Greater Element II

Next greater element in a circular array.

Medium
StackArrayMonotonic Stack
25 minAmazon · Google

Asteroid Collision

Simulate asteroid collisions; positives move right, negatives move left.

Medium
StackArraySimulation
25 minAmazon · Bloomberg +1

Simplify Path

Convert a Unix-style absolute path to its canonical form.

Medium
StackString
20 minFacebook · Microsoft +1

Decode String

Expand encoded strings of the form `k[encoded_string]`.

Medium
StackStringRecursion
25 minGoogle · Bloomberg +1

Remove K Digits

Remove k digits from a number string to make the smallest number.

Medium
StackGreedyString+1
25 minAmazon · Google

Largest Rectangle in Histogram

Find the largest rectangle that fits within a histogram of bar heights.

Hard
StackArrayMonotonic Stack
35 minAmazon · Microsoft +1

Validate Stack Sequences

Check if a pop sequence is achievable from a push sequence using a stack.

Medium
StackArraySimulation
20 minGoogle · Amazon

Binary Search

Classic binary search on a sorted array.

Easy
ArrayBinary Search
10 minAmazon · Microsoft +1

Search a 2D Matrix

Search a row- and column-sorted matrix where row[i+1][0] > row[i][last].

Medium
ArrayBinary SearchMatrix
15 minAmazon · Apple +1

Find Minimum in Rotated Sorted Array

Find the minimum in a rotated, otherwise-sorted array of unique values.

Medium
ArrayBinary Search
20 minAmazon · Microsoft +1

Search Insert Position

Return the index where target would be inserted in sorted nums.

Easy
ArrayBinary Search
10 minAmazon · Apple +1

Koko Eating Bananas

Find the minimum eating speed k that finishes all piles within h hours.

Medium
ArrayBinary Search
25 minGoogle · Amazon +1

Capacity to Ship Packages Within D Days

Minimum ship capacity to deliver weights[] in order within `days` days.

Medium
ArrayBinary Search
25 minAmazon · Goldman Sachs

Find First and Last Position of Element in Sorted Array

Return [first, last] indices of target in a sorted array, or [-1, -1].

Medium
ArrayBinary Search
20 minAmazon · LinkedIn +1

Search a 2D Matrix II

Search in a matrix sorted by rows and columns (weaker invariant).

Medium
ArrayBinary SearchMatrix+1
20 minAmazon · Apple +1

Sqrt(x)

Compute integer square root truncated toward zero.

Easy
MathBinary Search
15 minApple · Bloomberg +1

Single Element in a Sorted Array

Find the unique element in a sorted array where every other appears twice.

Medium
ArrayBinary Search
20 minAmazon · Bloomberg

Merge Two Sorted Lists

Merge two sorted linked lists into one sorted list.

Easy
Linked ListRecursion
15 minAmazon · Microsoft +2

Merge K Sorted Lists

Merge k sorted linked lists into one sorted list.

Hard
Linked ListHeapDivide and Conquer
30 minAmazon · Meta +2

Remove Nth Node From End of List

Remove the nth node counting from the end of a linked list.

Medium
Linked ListTwo Pointers
20 minAmazon · Microsoft +1

Add Two Numbers

Add two numbers represented as reverse-order linked lists.

Medium
Linked ListMath
25 minAmazon · Microsoft +2

Swap Nodes in Pairs

Swap every two adjacent nodes in a linked list.

Medium
Linked ListRecursion
20 minAmazon · Microsoft +1

Reorder List

Reorder L0→L1→…→Ln−1→Ln into L0→Ln→L1→Ln−1→L2→Ln−2→… in place.

Medium
Linked ListTwo PointersStack+1
25 minAmazon · Microsoft +1

Palindrome Linked List

Decide whether a linked list is a palindrome.

Easy
Linked ListTwo PointersStack+1
20 minAmazon · Apple +1

Middle of the Linked List

Return the second middle node (or the only middle for odd lengths).

Easy
Linked ListTwo Pointers
10 minAmazon · Microsoft

Odd Even Linked List

Group nodes at odd positions before nodes at even positions (1-indexed).

Medium
Linked List
20 minAmazon · Bloomberg

Remove Duplicates from Sorted List

Delete all duplicates so each value appears at most once.

Easy
Linked List
10 minAmazon · Apple

Partition List

Reorder so all nodes < x come before all nodes ≥ x, preserving relative order.

Medium
Linked ListTwo Pointers
20 minAmazon · Microsoft

Rotate List

Rotate the list to the right by k places.

Medium
Linked ListTwo Pointers
20 minAmazon · LinkedIn

Reverse Linked List II

Reverse the nodes between positions left and right (1-indexed).

Medium
Linked List
25 minAmazon · Microsoft +1

Reverse Nodes in K-Group

Reverse the nodes of the list k at a time; leave any remaining tail as-is.

Hard
Linked ListRecursion
35 minAmazon · Microsoft +1

Maximum Depth of Binary Tree

Return the depth of the deepest leaf in a binary tree.

Easy
TreeBinary TreeDFS+1
10 minAmazon · Microsoft +1

Same Tree

Decide whether two binary trees are structurally and value-wise identical.

Easy
TreeBinary TreeDFS+1
10 minAmazon · Bloomberg

Symmetric Tree

Decide whether a binary tree is mirror-symmetric around its center.

Easy
TreeBinary TreeDFS+1
15 minAmazon · Microsoft +1

Balanced Binary Tree

Decide whether a binary tree is height-balanced.

Easy
TreeBinary TreeDFS
15 minAmazon · Microsoft +1

Diameter of Binary Tree

Length of the longest path between any two nodes in a tree.

Easy
TreeBinary TreeDFS
20 minAmazon · Facebook +1

Binary Tree Level Order Traversal

Return the values at each level (top to bottom).

Medium
TreeBinary TreeBFS
15 minAmazon · Microsoft +1

Binary Tree Zigzag Level Order Traversal

Level order traversal where direction alternates per level.

Medium
TreeBinary TreeBFS
20 minAmazon · Microsoft +1

Binary Tree Right Side View

Return the values of the rightmost node at each level.

Medium
TreeBinary TreeBFS+1
15 minAmazon · Bloomberg +1

Validate Binary Search Tree

Decide whether a binary tree is a strict BST.

Medium
TreeBinary TreeBST+1
25 minAmazon · Microsoft +1

Lowest Common Ancestor of a Binary Search Tree

Find the lowest common ancestor of two values in a BST (return the LCA node's value).

Medium
TreeBinary TreeBST
15 minAmazon · Microsoft +1

Lowest Common Ancestor of a Binary Tree

LCA in a generic binary tree (no BST property). Returns LCA node's value.

Medium
TreeBinary TreeDFS
20 minAmazon · Meta +1

Kth Smallest Element in a BST

Return the k-th smallest element in a BST.

Medium
TreeBinary TreeBST+1
20 minAmazon · Bloomberg +1

Path Sum

Decide whether some root-to-leaf path sums to target.

Easy
TreeBinary TreeDFS
15 minAmazon · Microsoft

Binary Tree Maximum Path Sum

Maximum sum of any path between any two nodes (path may not pass through root).

Hard
TreeBinary TreeDFS+1
30 minAmazon · Meta +2

Count Good Nodes in Binary Tree

Count nodes whose value is ≥ every value on the root-to-node path.

Medium
TreeBinary TreeDFS
15 minAmazon · Microsoft

Binary Tree Preorder Traversal

Return the preorder traversal of a tree (root, left, right).

Easy
TreeBinary TreeDFS+1
10 minAmazon · Microsoft

Binary Tree Inorder Traversal

Return the inorder traversal of a tree (left, root, right).

Easy
TreeBinary TreeDFS+1
10 minAmazon · Microsoft +1

Binary Tree Postorder Traversal

Return the postorder traversal of a tree (left, right, root).

Easy
TreeBinary TreeDFS+1
10 minAmazon · Microsoft

Replace Words

Replace each word in a sentence with its shortest dictionary root.

Medium
TrieHash SetString
15 minAmazon · Bloomberg

Longest Word in Dictionary through Deleting

Find the longest word in dictionary that can be formed by deleting characters of s.

Medium
StringTwo PointersSorting
20 minAmazon · Google

Word Pattern

Decide whether a string follows a given pattern via bijective mapping.

Easy
Hash MapString
15 minUber · Capital One

Longest Common Prefix

Find the longest common prefix of an array of strings.

Easy
StringTrie
10 minAmazon · Adobe +1

Longest Word in Dictionary

Longest word that can be built one char at a time from other words in the dictionary.

Medium
StringTrieHash Set
20 minGoogle · Amazon

Kth Largest Element in an Array

Find the k-th largest value in an array.

Medium
HeapQuickselectSorting
20 minAmazon · Meta +2

Last Stone Weight

Simulate stone smashing using a max-heap; return the final stone's weight.

Easy
HeapGreedy
15 minAmazon

K Closest Points to Origin

Return the k points closest to (0,0) under Euclidean distance.

Medium
HeapSortingQuickselect
20 minAmazon · Meta +2

IPO

Pick at most k profitable projects under capital constraints.

Hard
HeapGreedySorting
25 minAmazon · Google

Reorganize String

Rearrange characters so that no two adjacent characters are equal.

Medium
HeapGreedyString
25 minAmazon · Microsoft +1

Minimum Cost to Connect Sticks

Repeatedly combine the two cheapest sticks; return total cost.

Medium
HeapGreedy
15 minAmazon

Furthest Building You Can Reach

Greedy: spend ladders on the largest jumps, bricks on smaller ones.

Medium
HeapGreedy
25 minAmazon · Google

Find K Pairs with Smallest Sums

Return the k pairs with the smallest sums from two sorted arrays.

Medium
HeapTwo PointersSorting
25 minLinkedIn · Amazon

Car Pooling

Decide whether car capacity is enough across all trips.

Medium
HeapSweep LineGreedy
15 minAmazon

Minimum Number of Refueling Stops

Greedy: always refuel at the largest unused station that is still reachable.

Hard
HeapGreedyDynamic Programming
30 minAmazon · Google

Meeting Rooms II

Minimum number of conference rooms to host all meetings.

Medium
HeapSweep LineGreedy
20 minAmazon · Google +1

Maximum Performance of a Team

Maximize sum(speed) × min(efficiency) for a team of at most k engineers.

Hard
HeapGreedySorting
30 minAmazon · Google

Subsets II

Return all unique subsets of an array that may contain duplicates.

Medium
BacktrackingArray
20 minMeta · Amazon

Permutations

Return all permutations of a unique-integer array.

Medium
BacktrackingArray
15 minAmazon · Microsoft

Permutations II

Return all unique permutations when the input contains duplicates.

Medium
BacktrackingArray
20 minMeta · Amazon

Combinations

Return all combinations of k numbers chosen from 1..n.

Medium
Backtracking
15 minAmazon

Combination Sum

All combinations from candidates that sum to target. Each candidate may be reused.

Medium
BacktrackingArray
20 minAmazon · Bloomberg

Combination Sum II

Each candidate may be used at most once; result must contain unique combinations.

Medium
BacktrackingArray
20 minAmazon · Microsoft

Combination Sum III

Find k-element combinations from 1..9 summing to n.

Medium
Backtracking
15 minAmazon

Letter Combinations of a Phone Number

Return all letter combinations the digit string could represent (T9 keypad).

Medium
BacktrackingString
15 minAmazon · Meta +1

Generate Parentheses

Generate all combinations of n well-formed parentheses.

Medium
BacktrackingString
15 minAmazon · Meta +1

Word Search

Decide whether a word can be traced through adjacent cells in a board.

Medium
BacktrackingMatrixDFS
25 minAmazon · Meta +1

Restore IP Addresses

Return all valid IPv4 addresses formed by inserting dots into a digit string.

Medium
BacktrackingString
25 minAmazon · Microsoft

Max Area of Island

Largest 4-connected '1' region in a binary grid.

Medium
GraphDFSBFS+1
20 minAmazon · Meta

Flood Fill

Replace all 4-connected pixels of a region with a target color.

Easy
GraphDFSBFS+1
15 minAmazon

Rotting Oranges

Multi-source BFS for the time until all fresh oranges rot.

Medium
GraphBFSMatrix
20 minAmazon

Pacific Atlantic Water Flow

Cells from which water can flow to both oceans.

Medium
GraphDFSBFS+1
25 minAmazon · Google

Shortest Path in Binary Matrix

Shortest 8-connected path of zeros from top-left to bottom-right.

Medium
GraphBFSMatrix
20 minAmazon

Course Schedule II

Return a valid order to take all courses or [] if impossible.

Medium
GraphTopological SortBFS
25 minAmazon · Meta +1

Number of Connected Components in an Undirected Graph

Count the number of connected components.

Medium
GraphUnion-FindDFS+1
15 minAmazon · Microsoft

Graph Valid Tree

Decide whether an undirected graph is a tree (connected and acyclic).

Medium
GraphUnion-FindDFS+1
20 minAmazon · Google

Redundant Connection

Find the edge that, if removed, makes the graph a tree.

Medium
GraphUnion-Find
20 minAmazon · Google

Word Ladder

Length of the shortest transformation sequence between two words.

Hard
GraphBFSString
30 minAmazon · Meta +1

Network Delay Time

Time for a signal sent from k to reach all nodes (Dijkstra).

Medium
GraphDijkstraHeap
25 minAmazon · Google

Cheapest Flights Within K Stops

Cheapest path from src to dst using at most k stops (Bellman-Ford).

Medium
GraphBellman-FordBFS
25 minAmazon · Google

Min Cost to Connect All Points

Minimum spanning tree of points under Manhattan distance.

Medium
GraphMSTUnion-Find
25 minAmazon · Google

Swim in Rising Water

Minimum time to swim from top-left to bottom-right (Dijkstra on max edge).

Hard
GraphDijkstraBinary Search
30 minAmazon · Google

Alien Dictionary

Infer the alphabet order from a list of words sorted in alien-language order.

Hard
GraphTopological SortBFS
35 minGoogle · Amazon +1

Path With Minimum Effort

Path from top-left to bottom-right minimizing maximum height delta.

Medium
GraphDijkstraBinary Search
25 minAmazon

Number of Provinces

Count connected components from a friendship adjacency matrix.

Medium
GraphUnion-FindDFS+1
15 minAmazon · Microsoft

Is Graph Bipartite?

Decide whether the given undirected graph is bipartite via 2-coloring.

Medium
GraphBFSDFS
20 minAmazon · Microsoft

Minimum Height Trees

Roots that minimize tree height — at most 2 valid centroids.

Medium
GraphTopological SortBFS
30 minGoogle · Amazon

Find the Town Judge

Find the unique node trusted by everyone but trusts no one.

Easy
GraphArray
10 minAmazon

Keys and Rooms

Decide whether all rooms can be visited starting from room 0.

Medium
GraphDFSBFS
15 minAmazon

House Robber II

Houses arranged in a circle — adjacent houses cannot both be robbed.

Medium
DPArray
20 minAmazon · Microsoft

Coin Change II

Number of distinct combinations of coins that sum to amount.

Medium
DP
20 minAmazon · Bloomberg

Partition Equal Subset Sum

Decide whether the array can be split into two equal-sum subsets.

Medium
DPArray
25 minAmazon · Meta

Maximum Product Subarray

Largest contiguous-subarray product, accounting for negatives.

Medium
DPArray
20 minAmazon · LinkedIn

Min Cost Climbing Stairs

Minimum cost to reach the top, taking 1 or 2 steps at a time.

Easy
DP
15 minAmazon

Target Sum

Number of ways to assign +/- signs to make the sum equal target.

Medium
DPBacktracking
25 minAmazon · Meta

Perfect Squares

Least number of perfect squares that sum to n.

Medium
DPMathBFS
20 minAmazon · Google

Integer Break

Maximum product when breaking n into ≥ 2 positive integers.

Medium
DPMath
20 minAmazon

Unique Paths

Number of paths from top-left to bottom-right moving only right or down.

Medium
DPMathCombinatorics
15 minAmazon · Google

Unique Paths II

Same as Unique Paths, but with obstacles blocking some cells.

Medium
DPMatrix
20 minAmazon

Minimum Path Sum

Cheapest path from top-left to bottom-right (right/down only).

Medium
DPMatrix
15 minAmazon · Google

Longest Common Subsequence

Length of the longest subsequence common to two strings.

Medium
DPString
25 minAmazon · Google

Distinct Subsequences

Number of distinct subsequences of s that equal t.

Hard
DPString
30 minAmazon · Google

Interleaving String

Decide whether s3 is an interleaving of s1 and s2.

Medium
DPString
25 minAmazon · Microsoft

Longest Palindromic Subsequence

Length of the longest subsequence of s that is a palindrome.

Medium
DPString
25 minAmazon

Regular Expression Matching

Implement '.' and '*' regex matching against an input string.

Hard
DPStringRegex
35 minMeta · Google +1

Jump Game

Decide whether you can reach the last index from the first.

Medium
GreedyArrayDP
15 minAmazon · Microsoft

Jump Game II

Minimum number of jumps to reach the last index.

Medium
GreedyArrayBFS
20 minAmazon · Microsoft

Gas Station

Find a starting station to complete the circuit, or -1 if impossible.

Medium
GreedyArray
20 minAmazon · Microsoft

Hand of Straights

Decide whether the hand can be split into groups of consecutive cards.

Medium
GreedyHash MapSorting
20 minGoogle · Amazon

Valid Parenthesis String

Decide whether the string with '(', ')', '*' wildcards is a valid balanced expression.

Medium
GreedyStringStack
20 minAmazon · Meta

Candy

Distribute minimum candy so children with higher ratings get more than neighbors.

Hard
GreedyArray
25 minAmazon · Microsoft

Task Scheduler

Minimum time to complete all tasks with cooldown constraint.

Medium
GreedyHeapHash Table
25 minAmazon · Meta +1

Queue Reconstruction by Height

Reconstruct queue from (height, k) pairs.

Medium
GreedySortingArray
25 minGoogle · Amazon

Insert Interval

Insert a new interval into a sorted, non-overlapping list and merge as needed.

Medium
IntervalsArray
20 minAmazon · Google

Non-overlapping Intervals

Min number of intervals to remove so the rest are non-overlapping.

Medium
IntervalsGreedy
20 minAmazon

Minimum Number of Arrows to Burst Balloons

Min number of arrows to pop all balloons (intervals on a number line).

Medium
IntervalsGreedy
20 minAmazon

Meeting Rooms

Decide whether one person can attend every meeting (no overlaps).

Easy
IntervalsSorting
10 minAmazon · Meta

Interval List Intersections

Intersection of two sorted, non-overlapping interval lists.

Medium
IntervalsTwo Pointers
25 minMeta · Amazon

Video Stitching

Min number of clips needed to cover [0, time].

Medium
IntervalsGreedyDP
25 minAmazon

Maximum Length of Pair Chain

Longest chain of pairs (a, b) where each next pair starts after previous ends.

Medium
IntervalsGreedyDP
20 minAmazon

Summary Ranges

Compress a sorted unique int list into ranges like '0->2'.

Easy
IntervalsArray
15 minGoogle · Meta

Remove Covered Intervals

Count intervals after removing those fully covered by another interval.

Medium
IntervalsSortingGreedy
20 minAmazon

Wiggle Subsequence

Length of the longest alternating-difference subsequence.

Medium
DPGreedyArray
20 minAmazon

Pow(x, n)

Compute x raised to the integer power n in O(log |n|).

Medium
MathRecursion
20 minAmazon · Meta +1

Count Primes

Count primes strictly less than n using the Sieve of Eratosthenes.

Medium
MathSieve
20 minAmazon · Microsoft

Multiply Strings

Multiply two non-negative integers represented as strings.

Medium
MathString
25 minMeta · Amazon

Add Binary

Add two binary strings and return the binary sum as a string.

Easy
MathStringBit Manipulation
15 minMeta · Amazon

Excel Sheet Column Number

Convert an Excel column title (A, B, ..., Z, AA, AB, ...) to its column number.

Easy
MathString
10 minMicrosoft · Amazon

Excel Sheet Column Title

Convert an integer column number to its Excel-style title.

Easy
MathString
10 minMicrosoft · Amazon

Roman to Integer

Convert a Roman numeral string to an integer.

Easy
MathStringHash Table
10 minAmazon · Bloomberg

Integer to Roman

Convert an integer in [1, 3999] to its Roman-numeral representation.

Medium
MathStringGreedy
15 minAmazon

Number of 1 Bits

Count the number of '1' bits in a non-negative integer.

Easy
Bit Manipulation
10 minApple · Microsoft

Counting Bits

Return an array where ans[i] = number of 1's in binary representation of i.

Easy
Bit ManipulationDP
15 minAmazon

Hamming Distance

Number of bit positions where two integers differ.

Easy
Bit Manipulation
10 minMeta

Power of Two

Decide whether a positive integer is a power of two.

Easy
Bit ManipulationMath
10 minAmazon

Power of Three

Decide whether n is a power of three.

Easy
Math
10 minGoogle

Power of Four

Decide whether n is a power of four.

Easy
Bit ManipulationMath
10 minTwo Sigma

Find the Difference

Find the extra letter that appears in t but not in s.

Easy
Bit ManipulationHash TableString
10 minGoogle

Single Number II

Find the element that appears once when every other element appears thrice.

Medium
Bit ManipulationArray
25 minAmazon

Fibonacci Number

Return the n-th Fibonacci number.

Easy
DPMath
10 minAmazon

N-th Tribonacci Number

Return the n-th Tribonacci number (sum of previous three).

Easy
DPMath
10 minAmazon

Ransom Note

Decide whether the magazine letters can construct the ransom note.

Easy
StringHash TableCounting
10 minApple

Ugly Number

Decide whether n's only prime factors are 2, 3, 5.

Easy
Math
10 minAmazon

Ugly Number II

Find the n-th ugly number (only prime factors 2, 3, 5).

Medium
MathDPHeap
20 minAmazon

Arranging Coins

Largest k such that k(k+1)/2 ≤ n.

Easy
MathBinary Search
10 minGoDaddy

Valid Perfect Square

Decide whether n is a perfect square (without sqrt).

Easy
MathBinary Search
10 minMicrosoft

Add Digits

Repeatedly sum a number's digits until a single-digit number remains.

Easy
Math
10 minAmazon

Monotonic Array

Decide whether the array is entirely non-decreasing or entirely non-increasing.

Easy
Array
10 minMeta

Find Pivot Index

Smallest index where left-sum equals right-sum.

Easy
ArrayPrefix Sum
10 minAmazon

Rotate String

Decide whether goal is a rotation of s.

Easy
String
10 minGoogle · Amazon

Reverse Integer

Reverse digits of a 32-bit signed integer; return 0 on overflow.

Medium
Math
15 minAmazon · Apple

Single Number III

Find the two numbers that appear once when every other number appears twice.

Medium
Bit ManipulationArray
25 minAmazon

Number Complement

Flip every bit in the binary representation of n.

Easy
Bit Manipulation
10 minAmazon

Base 7

Convert an integer to its base-7 string representation.

Easy
Math
10 minAmazon

Valid Triangle Number

Count triplets that can form the sides of a triangle.

Medium
ArrayTwo PointersSorting
25 minAmazon · Bloomberg

Maximum Sum of Subarrays of Size K

Largest sum among all contiguous subarrays of length k.

Easy
ArraySliding Window
15 minAmazon · Microsoft

Maximum Points You Can Obtain From Cards

Pick exactly k cards from either end to maximize total points.

Medium
ArraySliding WindowPrefix Sum
25 minGoogle · Amazon

Maximum Sum of Distinct Subarrays With Length K

Largest k-window sum where every element is distinct.

Medium
ArraySliding WindowHash Map
30 minAmazon · Bloomberg

Longest Valid Parentheses

Length of the longest substring of well-formed parentheses.

Hard
StringStackDynamic Programming
35 minAmazon · Google +1

Find K Closest Elements

Return the k closest values to x, in ascending order.

Medium
ArrayTwo PointersBinary Search+1
25 minAmazon · Microsoft +1

Binary Tree Tilt

Sum of |left subtree sum − right subtree sum| over every node.

Easy
TreeDepth-First SearchBinary Tree
20 minIndeed · Amazon

Path Sum II

Return all root-to-leaf paths whose values sum to the target.

Medium
TreeDepth-First SearchBacktracking+1
25 minAmazon · Meta +1

Longest Univalue Path

Longest path (in edges) between any two nodes with equal values.

Medium
TreeDepth-First SearchBinary Tree
30 minGoogle

Binary Tree Level Order Sum

Return the sum of node values at each level (top-down).

Easy
TreeBreadth-First SearchBinary Tree
15 minMicrosoft · Amazon

Maximum Width of Binary Tree

Width of the widest level (counting null gaps between extremes).

Medium
TreeBreadth-First SearchDepth-First Search+1
30 minAmazon · Apple

Surrounded Regions

Capture every 'O' region not connected to the border by flipping to 'X'.

Medium
MatrixDepth-First SearchBreadth-First Search+1
30 minAmazon · Meta +1

Minimum Knight Moves

Fewest knight moves from (0,0) to (x,y) on an infinite board.

Medium
Breadth-First Search
30 minGoogle · Stripe

01 Matrix

Distance from each cell to the nearest 0 in a binary matrix.

Medium
MatrixBreadth-First SearchDynamic Programming
25 minAmazon · Meta +1

Bus Routes

Fewest buses to take to get from source to target.

Hard
Hash MapBreadth-First Search
35 minAmazon · Google +1

Find the City With the Smallest Number of Neighbors at a Threshold Distance

City with fewest reachable cities within `distanceThreshold` (ties → largest id).

Medium
GraphDynamic ProgrammingShortest Path
35 minAmazon · Bloomberg

Maximal Square

Largest square sub-matrix containing only 1s; return its area.

Medium
MatrixDynamic Programming
30 minAmazon · Apple +1

Maximum Profit in Job Scheduling

Pick non-overlapping jobs to maximize total profit.

Hard
ArrayDynamic ProgrammingSorting+1
35 minGoogle · Bloomberg

Paint House

Cheapest way to paint n houses with no two adjacent same color (3 colors).

Medium
ArrayDynamic Programming
20 minLinkedIn · Amazon

Paint House II

Same as Paint House but with k colors — solve in O(n·k).

Hard
ArrayDynamic Programming
30 minFacebook · LinkedIn

Minimum Window Subsequence

Smallest window in s of which t is a subsequence (preserving order).

Hard
StringDynamic ProgrammingSliding Window
35 minGoogle · Pinterest

Spiral Matrix

Return all elements of a matrix in spiral order.

Medium
ArrayMatrixSimulation
25 minMicrosoft · Amazon +1

Rotate Image

Rotate an n×n matrix 90° clockwise in place.

Medium
ArrayMathMatrix
25 minMicrosoft · Amazon +1

Set Matrix Zeroes

If an element is 0, set its entire row and column to 0 in place.

Medium
ArrayHash MapMatrix
25 minAmazon · Meta +1

Count Vowel Substrings of a String

Count substrings consisting of only vowels and containing all five.

Easy
StringHash SetSliding Window
25 minAmazon

Implement Trie (Prefix Tree)

Design a trie supporting `insert`, `search`, and `startsWith` in O(L).

Medium
Hash TableStringDesign+1
30 minAmazon · Microsoft +2

Find Median From Data Stream

Maintain the running median of a stream with O(log n) inserts and O(1) reads.

Hard
Two HeapsDesignData Stream
35 minAmazon · Google +2