Problems
Every problem runs on the same real Python and JavaScript engines, with measured — not guessed — complexity.
3Summedium
time O(n^2), space O(n)array, two-pointers, sorting
Best Time to Buy and Sell Stockeasy
time O(n), space O(1)array, greedy
Container With Most Watermedium
time O(n), space O(1)array, two-pointers
Contains Duplicateeasy
time O(n), space O(n)array, hash-set
Find the Duplicate Numbermedium
time O(n), space O(1)two-pointers
Group Anagramsmedium
time O(n), space O(n)hash-map
House Robbermedium
time O(n), space O(1)dynamic-programming
House Robber IImedium
time O(n), space O(1)dynamic-programming
Jump Gamemedium
time O(n), space O(1)greedy
Longest Consecutive Sequencemedium
time O(n), space O(n)hash-set
Longest Substring Without Repeating Charactersmedium
time O(n), space O(n)sliding-window
Majority Elementeasy
time O(n), space O(1)array
Maximum Product Subarraymedium
time O(n), space O(1)dynamic-programming
Maximum Subarraymedium
time O(n), space O(1)array, dynamic-programming, kadane
Min Cost Climbing Stairseasy
time O(n), space O(1)dynamic-programming
Missing Numbereasy
time O(n), space O(1)array
Move Zeroeseasy
time O(n), space O(1)two-pointers
Product of Array Except Selfmedium
time O(n), space O(1)array, prefix-sum
Single Numbereasy
time O(n), space O(1)bit-manipulation
Sort Colorsmedium
time O(n), space O(1)two-pointers
Squares of a Sorted Arrayeasy
time O(n), space O(n)two-pointers
Top K Frequent Elementsmedium
time O(n), space O(n)hash-map, bucket-sort
Two Sumeasy
time O(n), space O(n)hash-map
Two Sum II - Input Array Is Sortedmedium
time O(n), space O(1)two-pointers
Valid Anagrameasy
time O(n), space O(n)hash-map
Valid Palindromeeasy
time O(n), space O(n)two-pointers
Add Two Numbersmedium
time O(n), space O(n)linked-list
Linked List Cycleeasy
time O(n), space O(1)linked-list, two-pointers
Linked List Cycle IImedium
time O(n), space O(1)linked-list, two-pointers
Merge Two Sorted Listseasy
time O(n), space O(n)linked-list, merge
Middle of the Linked Listeasy
time O(n), space O(1)linked-list, two-pointers
Palindrome Linked Listeasy
time O(n), space O(1)linked-list, two-pointers
Remove Nth Node From End of Listmedium
time O(n), space O(1)two-pointers, linked-list
Reorder Listmedium
time O(n), space O(1)linked-list, two-pointers
Reverse Linked Listeasy
time O(n), space O(1)linked-list, pointers
Balanced Binary Treeeasy
time O(n), space O(n)tree, recursion
Binary Tree Level Order Traversalmedium
time O(n), space O(n)binary-tree, bfs
Binary Tree Right Side Viewmedium
time O(n), space O(n)tree, bfs
Count Good Nodes in Binary Treemedium
time O(n), space O(n)tree, dfs
Diameter of Binary Treeeasy
time O(n), space O(n)tree, recursion
Invert Binary Treeeasy
time O(n), space O(n)tree, recursion
Maximum Depth of Binary Treeeasy
time O(n), space O(n)binary-tree, recursion, dfs
Path Sumeasy
time O(n), space O(n)tree, dfs
Range Sum of BSTeasy
time O(n), space O(n)tree, dfs
Same Treeeasy
time O(n), space O(n)tree, recursion
Symmetric Treeeasy
time O(n), space O(n)tree, recursion
Validate Binary Search Treemedium
time O(n), space O(n)binary-tree, recursion, dfs
Clone Graphmedium
time O(n), space O(n)graph, dfs-bfs
Course Schedulemedium
time O(n), space O(n)graph, topological-sort, bfs
Course Schedule IImedium
time O(n), space O(n)graph, topological-sort
Graph Valid Treemedium
time O(n), space O(n)graph, union-find
Number of Connected Components in an Undirected Graphmedium
time O(n), space O(n)graph, union-find
Number of Islandsmedium
time O(n), space O(n)graph, dfs, bfs, flood-fill
Flood Filleasy
time O(n), space O(n)grid, dfs-bfs
Rotate Imagemedium
time O(n), space O(1)matrix, in-place
Rotting Orangesmedium
time O(n), space O(n)graph, bfs, multi-source-bfs
Search a 2D Matrixmedium
time O(n), space O(1)matrix, two-pointers
Set Matrix Zeroesmedium
time O(n), space O(n)matrix
Spiral Matrixmedium
time O(n), space O(1)matrix, simulation
Climbing Stairseasy
time O(n), space O(1)dynamic-programming
Coin Changemedium
time O(n), space O(n)dynamic-programming
Decode Waysmedium
time O(n), space O(n)dynamic-programming
Longest Common Subsequencemedium
time O(n^2), space O(n^2)dynamic-programming
Longest Increasing Subsequencemedium
time O(n^2), space O(n)dynamic-programming
Minimum Path Summedium
time O(n), space O(n)dynamic-programming
Pascal's Triangleeasy
time O(n^2), space O(n^2)dynamic-programming
Unique Pathsmedium
time O(n), space O(n)dynamic-programming
Word Breakmedium
time O(n^2), space O(n)dynamic-programming