Array LeetCode Problems: All 1,569,
With Python Solutions

Every problem in this library that LeetCode tags Array. 1,332 of them carry a complete Python solution, a worked example and the time and space complexity of the approach.

Easy
330
Medium
862
Hard
377

Array problems by difficulty

Showing the first 200 of 1,569 problems. Problems with a complete Python solution are listed first, then by ascending problem number.

Easy (31)

Easy problems
No.Problem
0001Two Sum
0014Longest Common Prefix
0026Remove Duplicates from Sorted Array
0027Remove Element
0035Search Insert Position
0066Plus One
0088Merge Sorted Array
0108Convert Sorted Array to Binary Search Tree
0118Pascal's Triangle
0119Pascal's Triangle II
0121Best Time to Buy and Sell Stock
0136Single Number
0169Majority Element
0217Contains Duplicate
0219Contains Duplicate II
0228Summary Ranges
0268Missing Number
0283Move Zeroes
0303Range Sum Query - Immutable
0349Intersection of Two Arrays
0350Intersection of Two Arrays II
0414Third Maximum Number
0448Find All Numbers Disappeared in an Array
0455Assign Cookies
0463Island Perimeter
0485Max Consecutive Ones
0495Teemo Attacking
0496Next Greater Element I
0500Keyboard Row
0506Relative Ranks
0561Array Partition

Medium (128)

Medium problems
No.Problem
0011Container With Most Water
00153Sum
00163Sum Closest
00184Sum
0031Next Permutation
0033Search in Rotated Sorted Array
0034Find First and Last Position of Element in Sorted Array
0036Valid Sudoku
0039Combination Sum
0040Combination Sum II
0045Jump Game II
0046Permutations
0047Permutations II
0048Rotate Image
0049Group Anagrams
0053Maximum Subarray
0054Spiral Matrix
0055Jump Game
0056Merge Intervals
0057Insert Interval
0059Spiral Matrix II
0063Unique Paths II
0064Minimum Path Sum
0073Set Matrix Zeroes
0074Search a 2D Matrix
0075Sort Colors
0078Subsets
0079Word Search
0080Remove Duplicates from Sorted Array II
0081Search in Rotated Sorted Array II
0090Subsets II
0105Construct Binary Tree from Preorder and Inorder Traversal
0106Construct Binary Tree from Inorder and Postorder Traversal
0120Triangle
0122Best Time to Buy and Sell Stock II
0128Longest Consecutive Sequence
0130Surrounded Regions
0134Gas Station
0137Single Number II
0139Word Break
0150Evaluate Reverse Polish Notation
0152Maximum Product Subarray
0153Find Minimum in Rotated Sorted Array
0162Find Peak Element
0164Maximum Gap
0167Two Sum II - Input Array Is Sorted
0179Largest Number
0189Rotate Array
0198House Robber
0200Number of Islands
0204Count Primes
0209Minimum Size Subarray Sum
0213House Robber II
0215Kth Largest Element in an Array
0216Combination Sum III
0221Maximal Square
0229Majority Element II
0238Product of Array Except Self
0240Search a 2D Matrix II
0260Single Number III
0274H-Index
0275H-Index II
0284Peeking Iterator
0287Find the Duplicate Number
0289Game of Life
0300Longest Increasing Subsequence
0304Range Sum Query 2D - Immutable
0307Range Sum Query - Mutable
0309Best Time to Buy and Sell Stock with Cooldown
0313Super Ugly Number
0318Maximum Product of Word Lengths
0322Coin Change
0324Wiggle Sort II
0334Increasing Triplet Subsequence
0347Top K Frequent Elements
0368Largest Divisible Subset
0373Find K Pairs with Smallest Sums
0376Wiggle Subsequence
0377Combination Sum IV
0378Kth Smallest Element in a Sorted Matrix
0380Insert Delete GetRandom O(1)
0384Shuffle an Array
0393UTF-8 Validation
0396Rotate Function
0399Evaluate Division
0406Queue Reconstruction by Height
0413Arithmetic Slices
0416Partition Equal Subset Sum
0417Pacific Atlantic Water Flow
0419Battleships in a Board
0421Maximum XOR of Two Numbers in an Array
0427Construct Quad Tree
0435Non-overlapping Intervals
0436Find Right Interval
0442Find All Duplicates in an Array
0447Number of Boomerangs
0452Minimum Number of Arrows to Burst Balloons
0453Minimum Moves to Equal Array Elements
04544Sum II
0456132 Pattern
0457Circular Array Loop
0462Minimum Moves to Equal Array Elements II
0473Matchsticks to Square
0474Ones and Zeroes
0475Heaters
0477Total Hamming Distance
0486Predict the Winner
0491Non-decreasing Subsequences
0494Target Sum
0497Random Point in Non-overlapping Rectangles
0498Diagonal Traverse
0503Next Greater Element II
0518Coin Change II
0522Longest Uncommon Subsequence II
0523Continuous Subarray Sum
0524Longest Word in Dictionary through Deleting
0525Contiguous Array
0526Beautiful Arrangement
0528Random Pick with Weight
0529Minesweeper
0532K-diff Pairs in an Array
0539Minimum Time Difference
0540Single Element in a Sorted Array
054201 Matrix
0553Optimal Division
0554Brick Wall
0560Subarray Sum Equals K
0565Array Nesting

Hard (41)

Hard problems
No.Problem
0004Median of Two Sorted Arrays
0037Sudoku Solver
0041First Missing Positive
0042Trapping Rain Water
0051N-Queens
0068Text Justification
0084Largest Rectangle in Histogram
0085Maximal Rectangle
0123Best Time to Buy and Sell Stock III
0135Candy
0140Word Break II
0149Max Points on a Line
0154Find Minimum in Rotated Sorted Array II
0174Dungeon Game
0188Best Time to Buy and Sell Stock IV
0212Word Search II
0218The Skyline Problem
0220Contains Duplicate III
0239Sliding Window Maximum
0312Burst Balloons
0315Count of Smaller Numbers After Self
0321Create Maximum Number
0327Count of Range Sum
0329Longest Increasing Path in a Matrix
0330Patching Array
0335Self Crossing
0336Palindrome Pairs
0354Russian Doll Envelopes
0363Max Sum of Rectangle No Larger Than K
0381Insert Delete GetRandom O(1) - Duplicates allowed
0391Perfect Rectangle
0403Frog Jump
0407Trapping Rain Water II
0410Split Array Largest Sum
0446Arithmetic Slices II - Subsequence
0472Concatenated Words
0480Sliding Window Median
0493Reverse Pairs
0502IPO
0517Super Washing Machines
0546Remove Boxes

Eyes only

When the Array problem arrives live.

In the live round, Stealth Interview reads the problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer says. It's a desktop app for macOS and Windows, invisible to screen sharing.