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