Coding interview problems
Practice 75 classic coding interview problems in Python, JavaScript, Java, Go, and Rust. Run your code against real test cases, then read the step-by-step solutions with time & space complexity.
Your progress
0 / 75 solved
Prefer a structured plan?
Follow the ordered Interview Roadmap: 0/75 solved.
Browse by pattern
75 problems
Two Sum
Find the indices of two distinct values whose sum matches a target.
Merge Intervals
Sort and merge every overlapping or touching interval into a disjoint list.
Reverse a String
Return a string with every character in reverse order without changing characters.
Longest Common Prefix
Find the longest leading substring shared by every string in a list.
Palindrome String
Determine whether a phrase reads the same after ignoring case and non-alphanumeric characters.
Palindromic Substrings
Count every contiguous substring that reads the same forward and backward.
Longest Palindromic Substring
Return the longest contiguous substring that is a palindrome.
Palindrome Linked List
Check whether the values represented by a singly linked list form a palindrome.
Roman to Integer
Convert a valid canonical Roman numeral into its integer value.
Letter Combinations of a Phone Number
Generate every letter combination represented by digits on a telephone keypad.
Valid Parentheses
Validate that every bracket closes in the correct order and with the matching type.
Find the Index of the First Occurrence in a String
Return the starting index of the first exact occurrence of one string inside another.
Length of Last Word
Measure the final whitespace-delimited word in a string.
Spiral Matrix
Generate an n-by-n matrix filled clockwise in spiral order.
FizzBuzz
Produce the classic FizzBuzz sequence using divisibility rules.
Contains Duplicate
Determine whether any integer appears more than once in an array.
Maximum Subarray
Return the largest sum obtainable from a non-empty contiguous subarray.
Fibonacci Number
Compute the zero-indexed Fibonacci number with an iterative recurrence.
Factorial
Compute the product of all positive integers up to a non-negative input.
Move Zeroes
Move every zero to the end while preserving non-zero element order.
Single Number
Find the only value that is not paired using constant extra space.
Best Time to Buy and Sell Stock
Find the best profit from one buy followed by one later sale.
Valid Anagram
Check whether two lowercase strings contain identical character frequencies.
Binary Search
Locate a target in a sorted unique array using logarithmic search.
Count Vowels
Count ASCII vowels in a string without changing other characters.
Climbing Stairs
Count ordered one-step and two-step paths to the top of a staircase.
Product of Array Except Self
Build prefix and suffix products without division.
Trapping Rain Water
Compute water trapped between elevation bars after rainfall.
Edit Distance
Measure the minimum insertions, deletions, and replacements between two strings.
Median of Two Sorted Arrays
Find the combined median without fully merging two sorted arrays.
Longest Valid Parentheses
Measure the longest contiguous substring of balanced parentheses.
Palindrome Number
Determine whether a base-10 integer reads identically in reverse.
Plus One
Add one to a number represented as an array of digits.
Majority Element
Find the element that appears more than half the time in an array.
Is Subsequence
Check whether one string is a subsequence of another.
First Unique Character in a String
Find the index of the first non-repeating character in a string.
Search Insert Position
Return the index where a target should be inserted into a sorted array.
House Robber
Maximize the loot from non-adjacent houses along a street.
Jump Game
Decide whether you can reach the last index of an array of jump lengths.
Coin Change
Find the fewest coins needed to make up a given amount.
Longest Substring Without Repeating Characters
Find the length of the longest substring without repeating characters.
Container With Most Water
Find two lines that together with the x-axis hold the most water.
Number of Islands
Count the number of islands in a grid of land and water cells.
Word Break
Determine whether a string can be segmented into words from a dictionary.
Longest Increasing Subsequence
Find the length of the longest strictly increasing subsequence.
Largest Rectangle in Histogram
Find the area of the largest rectangle that fits under a histogram.
Sliding Window Maximum
Return the maximum of every contiguous window of size k.
Jump Game II
Find the minimum number of jumps needed to reach the last index.
Reverse Linked List
Reverse a singly linked list in place using real ListNode structures.
Maximum Depth of Binary Tree
Find the maximum depth of a binary tree using real TreeNode structures.
Course Schedule
Determine whether all courses can be completed given prerequisite pairs.
Rotting Oranges
Find how many minutes are needed for rot to spread to every fresh orange.
Redundant Connection
Find the edge that creates a cycle in an otherwise tree-shaped graph.
Kth Largest Element in an Array
Return the kth largest value without requiring a fully sorted array.
Top K Frequent Elements
Return the k values that occur most often in an integer array.
Subsets
Generate every subset in the power set of a distinct integer array.
Invert Binary Tree
Swap every binary-tree node's left and right children.
Same Tree
Determine whether two binary trees have identical structure and values.
Validate Binary Search Tree
Check whether a binary tree satisfies strict BST ordering.
Binary Tree Level Order Traversal
Return binary-tree values grouped by breadth-first level.
Lowest Common Ancestor of a BST
Find the lowest shared ancestor of two values in a binary search tree.
Merge Two Sorted Lists
Merge two sorted linked lists by rewiring their nodes.
Linked List Cycle
Detect a cycle from a linked list represented by next-node indices.
Reorder List
Reorder a linked list by alternating nodes from its front and back.
Clone Graph
Deep-copy a connected graph from its adjacency-list representation.
Pacific Atlantic Water Flow
Find grid cells that can flow to both oceans under height constraints.
Network Delay Time
Compute how long a weighted directed network takes to receive a signal.
Merge K Sorted Lists
Merge k sorted sequences using a heap of current candidates.
Find Median from Data Stream
Return the median after incrementally inserting every stream value.
Permutations
Generate every ordering of a distinct integer array.
Combination Sum
Find target-sum combinations when candidate values may be reused.
Word Search
Find a word by backtracking through adjacent grid cells.
Implement Trie
Execute insert, exact-search, and prefix-search operations on a trie.
Design Add and Search Words
Build a trie that supports exact letters and wildcard searches.
LRU Cache
Simulate a bounded least-recently-used key-value cache.