Array¶
How To: Aray
3 Sum [Two Pointers]
3 Sum closest [Two Pointers]
4 sum [Two pointer, Hash]
Remove duplicates from sorted array [Two pointers]
Remove element [Two pointers]
Next permutation [Tricky]
First missing positive [Tricky]
Rotate image
Spiral matrix [Simulation, Layer-by-Layer]
Spiral matrix ii
Plus one
Set matrix zeroes
Remove duplicates from sorted array II [Two Pointers]
Pascals triangle
Pascals triangle II
Best time to buy and sell stock
Longest consecutive sequence [BF, Sorting, Set -> Tricky]
Read N characters given read4()
Read N characters given read4() II [call multiple times]
Missing ranges
Majority element [Boyer-Moore Majority Vote Algorithm]
Rotate array
Minimum size subarray Sum [Binary Search]
K-th largest element in an array
Summary ranges
Majority element II
Product of array except self
Search a 2D matrix II
Shortest Word Distance
Shortest Word Distance III
Flatten 2D vector
Find the Celebrity
Game of life
Flip game
Best meeting point
Sparse Matrix multiplication
Increasing triplet subsequence
Range addition
Shuffle an array [EPI]
Rotate function
Fizz Buzz
Third maximum number
Battleships in a board
Valid word square
Find all duplicates in an array
Find all numbers disappeared in an array
Lonely pixel I
Lonely pixel II
Array nesting
Reshape the matrix
Shortest unsorted continuous subarray
Can place flowers
Maximum distance in arrays
Maximum average subarray I [Math]
Maximum average subarray II [Math]
Image smoother
Non decreasing array
Beautiful arrangement II
Maximum swap
Longest continuous increasing subsequence
K empty slots
Degree of an array
Subarray product less than K [Sliding window]
1 bit and 2 bit characters [Greedy]
Candy crush
Find pivot index
My calendar I
My calendar II
My calendar III
Largest number at least twice
Pour water
Toeplitz matrix
Max chunks to make sorted II [Sliding Window]
Max chunks to make sorted [Brute Force]
Swim in rising water
Number of matching subsequences
Valid tic-tac-toe state
Number of subarrays with bounded maximum
Bricks falling when hit [Reverse Time and Union-Find]
Max increase to keep city skyline [Row and Column Maximums]
Shortest distance to a character [Min Array]
Positions of large groups [Two Pointers]
Flipping an image [Direct]
Image overlap [Translate by Delta]
Magic squares in grid [Brute Force]
Split array into Fibonacci sequence [Brute Force]
Longest mountain in array [Two Pointers]
Maximize distance to closest person [Next Array]
Lemonade change [Simulation]
Transpose matrix [Copy Directly]
Spiral matrix III [Walk in a Spiral]
Fair candy swap [Solve the Equation]
Monotonic array [Two Pass,One Pass]
Sort array by parity [Sort, Two Pass, In-place]
Snakes and ladders [Breadth-First Search]
Partition array into disjoint intervals [Next Array]
Maximum sum circular subarray [Kadane, NextArray, PrefixSum+Monoqueue]
Sort array by parity II [Two Pass, Read/Write Heads]
3 sum with multiplicity [Three Pointer, Counting with Cases]
Three equal parts [Equal Ones]
Beautiful array [Divide and Conquer]
Valid mountain array [One Pass]
Minimum increment to make array unique [Counting, Maintain Duplicate Info]¶
Most stones removed with same row or column [DFS, Union-Find]
Largest time for given digits [Brute Force]
Reveal cards in increasing order [Simulation]
Largest Component Size By Common Factor [Union-Find]
Array of doubled pairs [Greedy]
N-repeated element in size 2N array [Count, Compare]
Longest turbulent subarray [Sliding Window]
Sum of even numbers after queries [Maintain Array Sum]
Add to array form of integer [Schoolbook Addition]
Find the town judge
Available captures for rook
Find common characters
Minimum domino rotations for equal row
Pairs of songs with total durations divisible by 60
Best sightseeing pair
Binary prefix divisible by 5
Partition array into 3 parts with equal sum
Matrix cells in distance order
Maximum sum of two non overlapping subarrays
Height checker
Grumpy bookstore owner
Flip columns for max number of equal rows
Number of submatrices that sum to target
Sum of digits in minimum number
Duplicate zeros
Statistics from large sample
Two sum less than K
Corporate flight bookings [Line Sweep]
Decrease elements to make array zigzag
Invalid transactions [Sliding Window, Line Sweep]
Diet plan performance [Sliding Window]
Distance between bus stops
Minimum absolute difference
Get equal substrings within budget [Sliding Window]
Queens that can attack the king
Cells with odd values in matrix
Shift 2D grid
Count servers that communicate
Find winner on a tic-tac-toe game
Find numbers with even number of digits
Replace elements with greatest element on right side
Find N unique integers sum up to zero
Decompress run length encoded list
Distinct echo substrings [KMP, Sliding Window, Rabin-Karp]
Sort the matrix diagonally [Sort]
Rank transform of an array
Filter restaurants by vegan friendly price distance [Sort]
The K weakest rows [OrderedDict, Quick Select]
Number of sub-arrays of size K and average >= threshold
Check if N and its double exist
Count negative numbers in a sorted matrix
Bulb switcher III
Lucky numbers in a matrix
Create target array in the given order
Find lucky integer in an array
Count largest group
Number of steps to reduce a number in binary representation to one
Minimum value to get positive step by step sum
Maximum points you can obtain from card [Sliding Window]
Counting elements
Perform string shifts
Leftmost column with at least a one
Kids with the greatest number of candies
Check if all 1’s are at least length k places away