Arrays Coding Problems: 1199 Questions with Solutions
1199 arrays coding problems — 320 easy · 633 medium · 246 hard — with solutions in 13 languages. Plus a step-by-step walkthrough and a 8-day plan.
- Problems: 1199
- By difficulty: 320 easy · 633 medium · 246 hard
- Languages: JavaScript, TypeScript, Python, Java, C++, C, C#, Go, Kotlin, Swift, Rust, PHP and Ruby
- Cost: Free on every plan; sign in to run and submit
The array is the first data structure every other one is built on: a block of values addressed by index in constant time. Array problems practise the moves that recur everywhere else — scanning once, keeping a running best, working from both ends, sorting first to make a hard question easy, and reasoning about indices without going off either end. Most of the catalogue touches an array somewhere; the problems here are the ones where the array itself is the point.
New to arrays? Read the Arrays tutorial first.
How arrays works, step by step
prices = [7, 1, 5, 3, 6, 4]- Selling on day i earns prices[i] minus the cheapest price before it. So one pass only has to remember two numbers: the cheapest price so far and the best profit so far.
- Day 0 costs 7. Nothing came before it, so 7 is the cheapest price so far and there is nothing to sell yet.
- Day 1 costs 1, below the old cheapest 7, so day 1 becomes the day to buy. Selling on the day you buy earns nothing, and the best profit stays 0.
- Day 2 costs 5. Buying at the cheapest earlier price (1, day 1) and selling today earns 5 − 1 = 4, so best = 4. Earlier days other than the cheapest can be forgotten: none of them is a better day to buy.
- Day 3 costs 3: selling today would earn 2, less than the best 4, and 3 is not below 1, so neither number changes.
- Day 4 costs 6. Buying at the cheapest earlier price (1, day 1) and selling today earns 6 − 1 = 5, so best = 5.
- Day 5 costs 4: selling today would earn 3, less than the best 5, and 4 is not below 1, so neither number changes.
- The best trade is to buy on day 1 at 1 and sell on day 4 at 6, a profit of 5. Each day was looked at once with two numbers kept, so it is O(n) time and O(1) space.
Arrays study plan
14 of the 1199 Arrays problems (4 easy, 7 medium and 3 hard) over 8 days, about 8 h 10 min in all — the pattern first, then easiest to hardest. After that, the other 1185 in the full list below are practice at your own pace. Then move on to Strings.
Day 1
Learn the pattern: read the essentials and step through the walkthrough above, then solve these 3.
Day 2
Medium problems: the same pattern with one twist each. Name the twist before you code.
- Richest Customer Wealth Easy
- Maximum Subarray Medium
Day 3
More mediums. Before coding each one, write down what state the pattern keeps and when it changes.
- Product of Array Except Self Medium
- Longest Consecutive Sequence Medium
Day 4
More mediums. Before coding each one, write down what state the pattern keeps and when it changes.
Day 5
More mediums. Before coding each one, write down what state the pattern keeps and when it changes.
- 3Sum Medium
- Container With Most Water Medium
Day 6
Hard problems: the pattern combined with a second idea. Give each a full attempt before reading the editorial.
- Trapping Rain Water Hard
Day 7
Another hard one. If it beats you after a real attempt, read the editorial, then solve it again tomorrow from memory.
Day 8
Another hard one. If it beats you after a real attempt, read the editorial, then solve it again tomorrow from memory.
Arrays: the essentials
When to reach for it
The input is a list of numbers and the question is about positions, order or aggregates: the best pair of days, an element's neighbours, a value's frequency, a rearrangement that must happen in place. With n up to 10⁵, comparing every pair is about 5 × 10⁹ steps, so the answer must come from one or two passes. "In place" or "O(1) extra space" means the array itself must hold the working state.
The pattern
Most array solutions are a single pass that carries a little state: the smallest value so far, a write index, a running total. Ask what you need to know about everything before index i to answer for i, keep exactly that, and update it in constant time. When the answer at i depends on both sides, a pass from the left and a pass from the right usually suffice — the idea behind Prefix Sum.
def max_profit(prices):
best, low = 0, float("inf")
for p in prices:
low = min(low, p) # cheapest day so far
best = max(best, p - low) # sell today
return best
Cost
One pass is O(n) time. The carried state is O(1) space, or O(n) when you keep a prefix or suffix array. Sorting first costs O(n log n) and usually reorders the caller's array.
Common mistakes
- Reading
nums[i + 1]ornums[i - 1]without guarding the ends. - Removing elements while looping by index, which skips the element that slides into the gap.
- Starting a running maximum at 0 when every value can be negative.
- Returning a new array when the problem wants the input modified and a length returned.
Start with
- Best Time to Buy and Sell Stock: one pass with a running minimum.
- Move Zeroes: a write index, in place.
- Product of Array Except Self: a left pass and a right pass.
All arrays problems
Easy (320)
- Brightest String of Diyas Sliding Window
- Design Neighbor Sum Service Hash Table, Matrix, Simulation
- Design an Ordered Stream Hash Table, Design
- Design HashMap Hash Table, Design
- Design HashSet Hash Table, Design
- Range Sum Query - Immutable Prefix Sum, Design
- Convert Sorted Array to Binary Search Tree Divide and Conquer, Tree
- Trionic Array I
- Minimum Cost to Reach Every Position
- Sum of Good Numbers
- Button with Longest Push Time
- Adjacent Increasing Subarrays Detection I
- Find Indices of Stable Mountains
- Longest Strictly Increasing or Strictly Decreasing Subarray
- Maximum Area of Longest Diagonal Rectangle
- Semi-Ordered Permutation Simulation
- 1-bit and 2-bit Characters
- Longest Continuous Increasing Subsequence
- Check if Any Element Has Prime Frequency Hash Table, Math, Counting
- Find the Largest Almost Missing Integer Hash Table
- Minimum Number of Operations to Make Elements in Array Distinct Hash Table
- Minimum Operations to Make Array Values Equal to K Hash Table
- Smallest Missing Integer Greater Than Sequential Prefix Sum Hash Table, Sorting
- Find Common Elements Between Two Arrays Hash Table
- Subarrays Distinct Element Sum of Squares I Hash Table
- Max Pair Sum in an Array Hash Table
- Find Maximum Number of String Pairs Hash Table, String, Simulation
- Check Distances Between Same Letters Hash Table, String
- Find Subarrays With Equal Sum Hash Table
- Merge Similar Items Hash Table, Sorting, Ordered Set
- Make Array Zero by Subtracting Equal Amounts Hash Table, Greedy, Sorting
- Most Frequent Number Following Key In an Array Hash Table, Counting
- Shortest Completing Word Hash Table, String
- Check if a String Is an Acronym of Words String
- Determine if Two Events Have Conflict String
- Counting Words With a Given Prefix String, String Matching
- Available Captures for Rook Matrix, Simulation
- Delete Columns to Make Sorted String
- Maximize Sum Of Array After K Negations Greedy, Sorting
- Nearest Smaller Element Stack, Monotonic Stack
- Minimum Positive Sum Subarray Sliding Window, Prefix Sum
- Find X-Sum of All K-Long Subarrays I Hash Table, Sliding Window, Heap (Priority Queue)
- Valid Boomerang Math, Geometry
- Surface Area of 3D Shapes Math, Geometry, Matrix
- Find Resultant Array After Removing Anagrams Hash Table, String, Sorting
- Kth Distinct String in an Array Hash Table, String, Counting
- Slowest Key String
- String Matching in an Array String, String Matching
- Range Addition II Math
- Keep Multiplying Found Values by Two Hash Table, Sorting, Simulation
- Count Elements With Strictly Smaller and Greater Elements Sorting, Counting
- Minimum Cost of Buying Candies With Discount Greedy, Sorting
- Check if Every Row and Column Contains All Numbers Hash Table, Matrix
- Finding 3-Digit Even Numbers Hash Table, Enumeration, Sorting
- Find Target Indices After Sorting Array Binary Search, Sorting
- Two Furthest Houses With Different Colors Greedy
- Smallest Index With Equal Value Math
- Two Out of Three Hash Table, Bit Manipulation
- Final Value of Variable After Performing Operations String, Simulation
- Count Special Quadruplets Hash Table, Enumeration
- Remove One Element to Make the Array Strictly Increasing Greedy
- Check if All the Integers in a Range Are Covered Hash Table, Prefix Sum
- Find Nearest Point That Has the Same X or Y Coordinate Geometry
- Check if Array Is Sorted and Rotated Sorting
- Number Of Rectangles That Can Form The Largest Square Counting
- Get Maximum in Generated Array Simulation
- Check Array Formation Through Concatenation Hash Table
- Detect Pattern of Length M Repeated K or More Times Enumeration
- Make Two Arrays Equal by Reversing Subarrays Hash Table, Sorting
- Element Appearing More Than 25% In Sorted Array Binary Search
- Distance Between Bus Stops Prefix Sum
- Valid Mountain Array Two Pointers
- Largest Number At Least Twice of Others Sorting
- Special Array I
- Type of Triangle Math, Sorting
- Find the Losers of the Circular Game Hash Table, Simulation
- Form Smallest Number From Two Digit Arrays Hash Table, Enumeration
- Delete Greatest Value in Each Row Matrix, Sorting, Simulation
- The Employee That Worked on the Longest Task
- Most Frequent Even Element Hash Table, Counting
- Number of Strings That Appear as Substrings in Word String
- Number of Senior Citizens String
- Find Words Containing Character String
- Count Prefixes of a Given String String
- Count the Number of Incremovable Subarrays I Two Pointers, Enumeration
- Modify the Matrix Matrix
- Find the Power of K-Size Subarrays I Sliding Window
- Find the XOR of Numbers Which Appear Twice Hash Table, Bit Manipulation
- Apple Redistribution into Boxes Greedy, Sorting
- Number of Beautiful Pairs Hash Table, Math, Counting
- Check if Array is Good Hash Table, Sorting
- Neither Minimum nor Maximum Sorting
- Alternating Groups I Sliding Window
- Distribute Elements Into Two Arrays I Simulation
- Minimum Sum of Mountain Triplets I Prefix Sum
- Find the Integer Added to Array I Math
- Minimum Operations to Exceed Threshold Value I
- Kids With the Greatest Number of Candies
- Separate the Digits in an Array Simulation
- Minimum Time Visiting All Points Math, Geometry
- Split the Array Hash Table, Counting
- Find Champion I Matrix, Graph
- Prime In Diagonal Math, Matrix, Number Theory
- Matrix Similarity After Cyclic Shifts Matrix, Simulation
- Determine the Winner of a Bowling Game Simulation
- Best Poker Hand Hash Table, Counting, Greedy
- Maximum Height of a Triangle Greedy, Enumeration, Simulation
- Minimum Amount of Time to Fill Cups Greedy, Math, Heap
- Take Gifts From the Richest Pile Heap, Simulation, Greedy
- Kth Missing Positive Number Binary Search
- Find Smallest Letter Greater Than Target Binary Search
- Count Subarrays of Length Three With a Condition Sliding Window
- Defuse the Bomb Sliding Window, Simulation
- Maximum Sum Subarray of Size K Sliding Window
- Shortest Word Distance String, Two Pointers
- Find Indices With Index and Value Difference I Two Pointers
- Pair With Given Difference Two Pointers, Sorting
- Count Number of Pairs With Absolute Difference K Hash Table, Counting
- Shortest Distance to Target String in a Circular Array String, Two Pointers
- Intersection of Multiple Arrays Hash Table, Counting
- DI String Match Two Pointers, Greedy, String
- Two Sum Less Than K Two Pointers, Sorting
- Find the Distance Value Between Two Arrays Two Pointers, Binary Search
- Merge Two 2D Arrays by Summing Values Two Pointers
- Shortest Subarray With OR at Least K I Bit Manipulation, Sliding Window
- Maximum Strong Pair XOR I Bit Manipulation, Trie
- Find the K-or of an Array Bit Manipulation
- Find the Maximum Divisibility Score Math, Counting
- Sum of Squares of Special Elements Math, Number Theory
- Number of Distinct Averages Hash Table, Two Pointers, Sorting
- Number of Lines To Write String String, Simulation
- Counting Elements Hash Table, Counting
- Largest Unique Number Hash Table, Sorting
- Maximum Number of Words Found in Sentences String
- Count the Number of Vowel Strings in Range String
- Check If String Is a Prefix of Array String
- Minimum Number Game Sorting, Simulation
- Count Pairs With Given Sum Hash Table
- Maximum Difference Between Adjacent Elements in a Circular Array
- Sort the People Sorting, Hash Table
- Left Rotate an Array by D Places Two Pointers
- Common Elements in Three Sorted Arrays Two Pointers
- Find Transition Point Binary Search
- Convert Array Into Zig-Zag Fashion Greedy
- Wave Array Sorting
- Minimum Operations to Collect Elements Hash Table, Simulation
- Maximum Sum With Exactly K Elements Greedy
- Find the Array Concatenation Value Two Pointers, Simulation
- Sum of Values at Indices With K Set Bits Bit Manipulation
- Find the Distinct Difference Array Hash Table, Prefix Sum
- Maximum Ascending Subarray Sum
- Find the Peaks Enumeration
- The Two Sneaky Numbers of Digitville Hash Table
- Find the Difference of Two Arrays Hash Table
- Largest Positive Integer That Exists With Its Negative Hash Table, Two Pointers
- Maximum Number of Pairs in Array Hash Table, Counting
- Rank Transform of an Array Hash Table, Sorting
- N-Repeated Element in Size 2N Array Hash Table
- Find Common Characters String, Hash Table
- Keyboard Row String, Hash Table
- Minimum Index Sum of Two Lists String, Hash Table
- Count Elements With Maximum Frequency Hash Table, Counting
- Sum of Unique Elements Hash Table, Counting
- Unique Number of Occurrences Hash Table
- Points That Intersect With Cars Prefix Sum
- Minimum Right Shifts to Sort the Array
- Count Tested Devices After Test Operations Simulation, Counting
- Ant on the Boundary Prefix Sum, Simulation
- Number of Employees Who Met the Target
- Check If It Is a Straight Line Math, Geometry
- Add to Array-Form of Integer Math
- Split Strings by Separator String
- Maximum Value of a String in an Array String
- Odd String Difference String, Hash Table
- Find First Palindromic String in the Array String, Two Pointers
- Count Common Words With One Occurrence String, Hash Table
- Redistribute Characters to Make All Strings Equal String, Counting
- Verifying an Alien Dictionary String, Hash Table
- Unique Morse Code Words String, Hash Table
- Union of Two Sorted Arrays Two Pointers
- Chocolate Distribution Problem Sorting, Sliding Window
- Divide Array Into Equal Pairs Hash Table, Bit Manipulation
- Count Equal and Divisible Pairs in an Array
- Maximum Difference Between Increasing Elements
- Maximum Population Year Prefix Sum, Counting
- Minimum Distance to the Target Element
- Minimum Operations to Make the Array Increasing Greedy
- Sign of the Product of an Array Math
- Number of Students Doing Homework at a Given Time
- Check If All 1's Are at Least Length K Places Away
- Teemo Attacking Simulation
- Minimum Subsequence in Non-Increasing Order Greedy, Sorting
- Find Lucky Integer in an Array Hash Table, Counting
- Minimum Value to Get Positive Step by Step Sum Prefix Sum
- Find N Unique Integers Sum up to Zero Math
- Replace Elements with Greatest Element on Right Side
- Distribute Candies to People Math, Simulation
- Duplicate Zeros Two Pointers
- Partition Array Into Three Parts With Equal Sum Greedy, Prefix Sum
- X of a Kind in a Deck of Cards Math, Number Theory
- Fair Candy Swap Hash Table
- Monotonic Array
- Equilibrium Point Prefix Sum
- Leaders in an Array
- Second Largest Element
- Sum of All Subset XOR Totals Math, Backtracking, Bit Manipulation
- Count the Number of Consistent Strings Hash Table, String, Bit Manipulation
- Decode XORed Array Bit Manipulation
- Number of Students Unable to Eat Lunch Stack, Queue, Simulation
- Time Needed to Buy Tickets Queue, Simulation
- Final Prices With a Special Discount in a Shop Stack, Monotonic Stack
- Crawler Log Folder String, Stack
- Baseball Game String, Stack, Simulation
- Sort Even and Odd Indices Independently Sorting
- Sort Integers by The Number of 1 Bits Bit Manipulation, Sorting, Counting
- Maximum Product of Three Numbers Math, Sorting
- Minimum Absolute Difference Sorting
- Sort Array by Increasing Frequency Hash Table, Sorting
- Smallest Range I Math
- Largest Perimeter Triangle Math, Greedy, Sorting
- Sort Array By Parity II Two Pointers, Sorting
- Minimum Cost to Move Chips to The Same Position Math, Greedy
- Maximum Units on a Truck Greedy, Sorting
- Assign Cookies Two Pointers, Greedy, Sorting
- Special Positions in a Binary Matrix Matrix
- Projection Area of 3D Shapes Math, Geometry, Matrix
- Matrix Cells in Distance Order Math, Matrix, Sorting
- Find Winner on a Tic Tac Toe Game Hash Table, Matrix, Simulation
- Convert 1D Array Into 2D Array Matrix, Simulation
- Cells with Odd Values in a Matrix Math, Simulation
- Largest Local Values in a Matrix Matrix
- Row With Maximum Ones Matrix
- Check if Matrix Is X-Matrix Matrix
- Determine Whether Matrix Can Be Obtained By Rotation Matrix
- Pascal's Triangle II Dynamic Programming
- Number of Equivalent Domino Pairs Hash Table, Counting
- The K Weakest Rows in a Matrix Binary Search, Sorting, Heap
- Shift 2D Grid Matrix, Simulation
- Lucky Numbers in a Matrix Matrix
- Count Negative Numbers in a Sorted Matrix Binary Search, Matrix
- Image Smoother Matrix
- Flipping an Image Two Pointers, Matrix, Simulation
- Reshape the Matrix Matrix, Simulation
- Toeplitz Matrix Matrix
- Maximum Count of Positive Integer and Negative Integer Binary Search, Counting
- Number of Arithmetic Triplets Hash Table, Two Pointers, Enumeration
- Difference Between Element Sum and Digit Sum of an Array Math
- Left and Right Sum Differences Prefix Sum
- Apply Operations to an Array Two Pointers, Simulation
- Minimum Common Value Hash Table, Two Pointers, Binary Search
- Count Pairs Whose Sum is Less than Target Two Pointers, Binary Search, Sorting
- Minimum Number of Moves to Seat Everyone Greedy, Sorting, Counting Sort
- Maximum Product Difference Between Two Pairs Greedy, Sorting
- Special Array With X Elements Greater Than or Equal X Binary Search, Sorting, Counting Sort
- Count Good Triplets Enumeration
- Three Consecutive Odds
- Maximum Product of Two Elements in an Array Sorting, Heap
- Array Partition Greedy, Sorting, Counting Sort
- Minimum Difference Between Highest and Lowest of K Scores Sliding Window, Sorting
- Check If N and Its Double Exist Hash Table, Two Pointers, Sorting
- Can Make Arithmetic Progression From Sequence Sorting
- Shortest Distance to a Character Two Pointers, String
- Remove Element Two Pointers
- Check If Two String Arrays Are Equivalent String
- Unique Email Addresses Hash Table, String
- Truncate Sentence String
- Shuffle String String
- Relative Sort Array Hash Table, Sorting, Counting Sort
- Height Checker Sorting, Counting Sort
- Sort Array By Parity Two Pointers, Sorting
- Distribute Candies Hash Table, Greedy
- Longest Harmonious Subsequence Hash Table, Sorting, Sliding Window
- Degree of an Array Hash Table
- Can Place Flowers Greedy
- Third Maximum Number Sorting
- Max Consecutive Ones
- Sum of All Odd Length Subarrays Math, Prefix Sum
- Find the Highest Altitude Prefix Sum
- Create Target Array in the Given Order Simulation
- Decompress Run-Length Encoded List Simulation
- Concatenation of Array Simulation
- Build Array from Permutation Simulation
- Shuffle the Array
- Number of Good Pairs Hash Table, Math, Counting
- How Many Numbers Are Smaller Than the Current Number Hash Table, Counting Sort
- Running Sum of 1d Array Prefix Sum
- Find Pivot Index Prefix Sum
- Set Mismatch Hash Table, Bit Manipulation, Sorting
- Intersection of Two Arrays II Hash Table, Two Pointers, Sorting
- Intersection of Two Arrays Hash Table, Two Pointers, Sorting
- Contains Duplicate II Hash Table, Sliding Window
- Find Numbers with Even Number of Digits Math
- Find Greatest Common Divisor of Array Math, Number Theory
- Plus One Math
- Summary Ranges
- Meeting Rooms Sorting, Intervals
- Island Perimeter Matrix
- Flood Fill Matrix, Depth-First Search, Breadth-First Search
- Richest Customer Wealth Matrix
- Matrix Diagonal Sum Matrix
- Pascal's Triangle Dynamic Programming
- Transpose Matrix Matrix, Simulation
- Relative Ranks Heap, Sorting
- Last Stone Weight Heap
- Min Cost Climbing Stairs Dynamic Programming
- Lemonade Change Greedy
- Next Greater Element I Stack, Hash Table
- Search Insert Position Binary Search
- Squares of a Sorted Array Two Pointers, Sorting
- Merge Sorted Array Two Pointers, Sorting
- Single Number Bit Manipulation
- Find All Numbers Disappeared in an Array Hash Table
- Missing Number Math, Bit Manipulation
- Majority Element Hash Table, Divide and Conquer
- Remove Duplicates from Sorted Array Two Pointers
- Move Zeroes Two Pointers
- Best Time to Buy and Sell Stock Dynamic Programming
- Contains Duplicate Hash Table, Sorting
- Binary Search Binary Search
- Two Sum Hash Table
Medium (633)
- Implement Router Hash Table, Binary Search, Queue
- Design Memory Allocator Hash Table, Simulation, Design
- Design a Food Rating System Hash Table, String, Heap (Priority Queue)
- Design an ATM Machine Greedy, Design
- Design Bitset Hash Table, String, Design
- Range Frequency Queries Hash Table, Binary Search, Segment Tree
- Simple Bank System Hash Table, Simulation, Design
- Detect Squares Hash Table, Counting, Design
- Operations on Tree Hash Table, Tree, Depth-First Search
- Finding Pairs With a Certain Sum Hash Table, Design
- Design Front Middle Back Queue Linked List, Design, Queue
- Design Browser History Linked List, Stack, Design
- Design a Stack With Increment Operation Stack, Design
- Product of the Last K Numbers Math, Prefix Sum, Design
- Snapshot Array Hash Table, Binary Search, Design
- Online Election Hash Table, Binary Search, Design
- RLE Iterator Counting, Design
- My Calendar II Binary Search, Ordered Set, Prefix Sum
- My Calendar I Binary Search, Ordered Set, Segment Tree
- Design Circular Deque Queue, Design
- Design Circular Queue Queue, Design
- Range Sum Query - Mutable Binary Indexed Tree, Segment Tree, Design
- Range Sum Query 2D - Immutable Matrix, Prefix Sum, Design
- Delete Nodes From Linked List Present in Array Hash Table, Linked List
- Spiral Matrix IV Linked List, Matrix, Simulation
- Next Greater Node In Linked List Linked List, Stack, Monotonic Stack
- Linked List Components Linked List, Hash Table
- Closest Nodes Queries in a Binary Search Tree Tree, Binary Search, Depth-First Search
- Create Binary Tree From Descriptions Tree, Hash Table
- Construct Binary Search Tree from Preorder Traversal Stack, Tree, Binary Search
- Maximum Binary Tree Divide and Conquer, Stack, Tree
- Construct Binary Tree from Inorder and Postorder Traversal Tree, Hash Table, Divide and Conquer
- Construct Binary Tree from Preorder and Inorder Traversal Tree, Hash Table, Divide and Conquer
- All Divisions With the Highest Score of a Binary Array Prefix Sum
- Count the Hidden Sequences Prefix Sum
- Intervals Between Identical Elements Hash Table, Prefix Sum
- Find Good Days to Rob the Bank Dynamic Programming, Prefix Sum
- Maximum Number of Non-Overlapping Subarrays With Sum Equals Target Hash Table, Greedy, Prefix Sum
- Adjacent Increasing Subarrays Detection II Binary Search
- Collecting Chocolates Enumeration
- Number of Adjacent Elements With the Same Color Simulation
- Sum of Even Numbers After Queries Simulation
- Maximize Distance to Closest Person Two Pointers
- Count Special Triplets Hash Table, Counting
- Count Covered Buildings Hash Table, Sorting
- Closest Equal Element Queries Hash Table, Binary Search
- Count Special Subsequences Hash Table, Math, Enumeration
- Identify the Largest Outlier in an Array Hash Table, Counting, Enumeration
- Report Spam Message Hash Table, String
- Count Almost Equal Pairs I Hash Table, Sorting, Counting
- Find Occurrences of an Element in an Array Hash Table
- Find the Length of the Longest Common Prefix Hash Table, String, Trie
- Find the Maximum Number of Elements in Subset Hash Table, Enumeration
- Maximum Square Area by Removing Fences From a Field Hash Table, Enumeration
- Count Pairs of Points With Distance k Hash Table, Bit Manipulation
- Minimum Seconds to Equalize a Circular Array Hash Table, Greedy
- Minimum Index of a Valid Split Hash Table, Sorting
- Number of Black Blocks Hash Table, Enumeration
- Relocate Marbles Hash Table, Sorting, Simulation
- Max Sum of a Pair With Equal Sum of Digits Hash Table, Sorting, Heap (Priority Queue)
- Sender With Largest Word Count Hash Table, String, Counting
- Count Artifacts That Can Be Extracted Hash Table, Simulation
- Minimum Operations to Make the Array Alternating Hash Table, Greedy, Counting
- Finding the Users Active Minutes Hash Table
- Number of Ways Where Square of Number Is Equal to Product of Two Numbers Hash Table, Math, Two Pointers
- Check If Array Pairs Are Divisible by k Hash Table, Counting
- Making File Names Unique Hash Table, String
- Flip Columns For Maximum Number of Equal Rows Hash Table, Matrix
- Vowel Spellchecker Hash Table, String
- Card Flipping Game Hash Table
- Rabbits in Forest Hash Table, Math, Greedy
- Shortest Uncommon Substring in an Array Hash Table, String, Trie
- Number of Subarrays That Match a Pattern I Rolling Hash, String Matching
- Remove Sub-Folders from the Filesystem String, Depth-First Search, Trie
- Invalid Transactions Hash Table, String, Sorting
- Largest Time for Given Digits String, Enumeration
- Shifting Letters String, Prefix Sum
- Longest Uncommon Subsequence II Hash Table, Two Pointers, String
- Power Grid Maintenance Hash Table, Depth-First Search, Breadth-First Search
- Count Islands With Total Value Divisible by K Depth-First Search, Breadth-First Search, Union Find
- Minimum Increments to Equalize Leaf Paths Dynamic Programming, Tree, Depth-First Search
- Find Minimum Time to Reach Last Room II Graph, Heap (Priority Queue), Matrix
- Find Minimum Time to Reach Last Room I Graph, Heap (Priority Queue), Matrix
- Find Subtree Sizes After Changes Hash Table, String, Tree
- Find a Safe Walk Through a Grid Breadth-First Search, Graph, Heap (Priority Queue)
- Shortest Distance After Road Addition Queries I Breadth-First Search, Graph
- Minimum Cost to Convert String I String, Graph, Shortest Path
- Minimum Cost of a Path With Special Roads Graph, Heap (Priority Queue), Shortest Path
- Disconnect Path in a Binary Matrix by at Most One Flip Dynamic Programming, Depth-First Search, Breadth-First Search
- K Highest Ranked Items Within a Price Range Breadth-First Search, Sorting, Heap (Priority Queue)
- Minimum Operations to Convert Number Breadth-First Search
- Coloring A Border Depth-First Search, Breadth-First Search, Matrix
- Count Partitions With Max-Min Difference at Most K Dynamic Programming, Queue, Sliding Window
- Best Time to Buy and Sell Stock V Dynamic Programming
- Maximum Frequency After Subarray Operation Hash Table, Dynamic Programming, Greedy
- Maximum Amount of Money Robot Can Earn Dynamic Programming, Matrix
- Count Paths With the Given XOR Value Dynamic Programming, Bit Manipulation, Matrix
- Count Beautiful Splits in an Array Dynamic Programming
- Minimum Array Sum Dynamic Programming
- Maximum Points Tourist Can Earn Dynamic Programming, Matrix
- Find Maximum Removals From Source String Hash Table, Two Pointers, String
- Maximum Total Damage With Spell Casting Hash Table, Two Pointers, Binary Search
- Maximum Total Reward Using Operations I Dynamic Programming, Bit Manipulation
- Maximum Difference Score in a Grid Dynamic Programming, Matrix
- Minimum Number of Operations to Satisfy Conditions Dynamic Programming, Matrix
- Maximum Number of Jumps to Reach the Last Index Dynamic Programming
- Decremental String Concatenation String, Dynamic Programming
- Minimum Path Cost in a Grid Dynamic Programming, Matrix
- First Day Where You Have Been in All the Rooms Dynamic Programming
- Best Team With No Conflicts Dynamic Programming, Sorting
- Gold Mine Problem Dynamic Programming, Matrix
- Maximum Sum Increasing Subsequence Dynamic Programming
- Longest Bitonic Subsequence Dynamic Programming
- Optimal Strategy For A Game Dynamic Programming, Game Theory
- Perfect Sum Problem Dynamic Programming
- Subset Sum Problem Dynamic Programming
- Rod Cutting Dynamic Programming
- 0/1 Knapsack Dynamic Programming
- Non-decreasing Subsequences Hash Table, Backtracking, Bit Manipulation
- Construct the Lexicographically Largest Valid Sequence Backtracking
- Matchsticks to Square Backtracking, Bitmask, Dynamic Programming
- Combination Sum III Backtracking
- Combination Sum II Backtracking
- Permutations II Backtracking, Sorting
- Subsets II Backtracking, Bit Manipulation
- Largest Submatrix With Rearrangements Greedy, Sorting, Matrix
- Count Unguarded Cells in the Grid Matrix, Simulation
- Largest Magic Square Matrix, Prefix Sum
- Get Biggest Three Rhombus Sums in a Grid Matrix, Prefix Sum, Sorting
- Valid Tic-Tac-Toe State Matrix, Simulation
- Queens That Can Attack the King Matrix, Simulation
- Minesweeper Breadth-First Search, Depth-First Search, Matrix
- Battleships in a Board Depth-First Search, Matrix
- Minimum Swaps to Arrange a Binary Grid Greedy, Matrix
- Largest 1-Bordered Square Dynamic Programming, Matrix
- Image Overlap Matrix, Enumeration
- Maximum Non Negative Product in a Matrix Dynamic Programming, Matrix
- Minimum Operations to Write the Letter Y on a Grid Hash Table, Matrix, Counting
- Difference of Number of Distinct Values on Diagonals Hash Table, Matrix
- Maximum Sum of an Hourglass Matrix, Prefix Sum
- Diagonal Traverse II Sorting, Matrix
- Minimum Jumps to Reach Home Dynamic Programming, Breadth-First Search
- Count Nodes With the Highest Score Tree, Depth-First Search, Binary Search
- Most Profitable Path in a Tree Tree, Depth-First Search, Graph
- The Time When the Network Becomes Idle Graph, Breadth-First Search
- Nearest Exit from Entrance in Maze Matrix, Breadth-First Search
- Minimize Hamming Distance After Swap Operations Union Find, Depth-First Search
- Visit Array Positions to Maximize Score Dynamic Programming
- Maximum Multiplication Score Dynamic Programming
- Maximum Energy Boost From Two Drinks Dynamic Programming
- Find the Maximum Length of a Good Subsequence I Hash Table, Dynamic Programming
- Maximum Number of Operations With the Same Score II Dynamic Programming, Memoization
- Ways to Split Array Into Good Subarrays Math, Dynamic Programming
- Maximize the Profit as the Salesman Dynamic Programming, Sorting, Binary Search
- Solving Questions With Brainpower Dynamic Programming
- Maximum Earnings From Taxi Hash Table, Dynamic Programming, Sorting
- Minimize the Difference Between Target and Chosen Elements Dynamic Programming, Matrix
- Minimum Total Space Wasted With K Resizing Operations Dynamic Programming
- Minimum Sideway Jumps Dynamic Programming, Greedy
- Closest Dessert Cost Dynamic Programming, Backtracking
- Stone Game VI Greedy, Sorting, Game Theory
- Filling Bookcase Shelves Dynamic Programming
- Minimum Score Triangulation of Polygon Dynamic Programming
- Length of Longest Fibonacci Subsequence Hash Table, Dynamic Programming
- Binary Trees With Factors Hash Table, Dynamic Programming, Sorting
- Minimize Maximum Pair Sum in Array Two Pointers, Greedy, Sorting
- Maximum Strength of a Group Greedy, Sorting, Enumeration
- Maximum Number of Weeks for Which You Can Work Greedy
- Delete Columns to Make Sorted II String, Greedy
- Score After Flipping Matrix Greedy, Bit Manipulation, Matrix
- Minimum Cost to Make Array Equalindromic Math, Greedy, Sorting
- Minimum Number of Coins for Fruits Dynamic Programming, Monotonic Queue
- Minimum Increment Operations to Make Array Beautiful Dynamic Programming
- Minimum Number of Groups to Create a Valid Assignment Hash Table, Greedy
- Maximum Matching of Players With Trainers Two Pointers, Greedy, Sorting
- Maximum Element After Decreasing and Rearranging Greedy, Sorting
- Minimum Number of Coins to be Added Greedy, Sorting
- Two Best Non-Overlapping Events Binary Search, Dynamic Programming, Sorting
- Divide Intervals Into Minimum Number of Groups Greedy, Sorting, Heap (Priority Queue)
- Describe the Painting Hash Table, Sorting, Prefix Sum
- Range Sum of Sorted Subarray Sums Two Pointers, Binary Search, Sorting
- Choose K Elements With Maximum Sum Sorting, Heap (Priority Queue)
- Mark Elements on Array by Performing Queries Hash Table, Sorting, Heap (Priority Queue)
- Remove Stones to Minimize the Total Greedy, Heap (Priority Queue)
- Next Greater Frequency Element Hash Table, Stack, Monotonic Stack
- The Celebrity Problem Stack, Two Pointers, Graph
- Jump Game VI Dynamic Programming, Queue, Monotonic Queue
- Beautiful Towers II Stack, Monotonic Stack
- Find the Most Competitive Subsequence Stack, Greedy, Monotonic Stack
- Largest Number After Mutating Substring String, Greedy
- Count Submatrices With All Ones Stack, Matrix, Monotonic Stack
- Maximum Subarray Min-Product Stack, Monotonic Stack, Prefix Sum
- Steps to Make Array Non-decreasing Stack, Monotonic Stack
- Exclusive Time of Functions Stack
- Stock Span Problem Stack, Monotonic Stack
- K-th Element of Two Sorted Arrays Binary Search, Divide and Conquer
- Minimum Absolute Difference Between Elements With Constraint Binary Search, Ordered Set, Binary Indexed Tree
- Minimum Sum of Squared Difference Binary Search, Greedy, Sorting
- Earliest Second to Mark Indices I Binary Search, Greedy
- Median in a Row-Wise Sorted Matrix Binary Search, Matrix
- Minimum Number of Seconds to Make Mountain Height Zero Math, Binary Search, Heap (Priority Queue)
- Maximum Number of Alloys Binary Search
- Minimum Operations to Make All Array Elements Equal Binary Search, Sorting, Prefix Sum
- Minimum Absolute Sum Difference Binary Search, Sorting, Ordered Set
- Count Number of Rectangles Containing Each Point Hash Table, Binary Search, Sorting
- Maximum Tastiness of Candy Basket Binary Search, Greedy, Sorting
- Minimized Maximum of Products Distributed to Any Store Binary Search, Greedy
- Minimum Absolute Difference Queries Hash Table, Binary Search, Prefix Sum
- Maximum Side Length of a Square with Sum Less than or Equal to Threshold Binary Search, Matrix, Prefix Sum
- Sum of Mutated Array Closest to Target Binary Search, Sorting
- Heaters Binary Search, Sorting, Two Pointers
- Number of Smooth Descent Periods of a Stock Math, Dynamic Programming
- Shortest Subarray With OR at Least K II Bit Manipulation, Sliding Window
- Maximize Win From Two Segments Binary Search, Sliding Window
- Maximum White Tiles Covered by a Carpet Sliding Window, Sorting, Prefix Sum
- K Divisible Elements Subarrays Hash Table, Trie, Enumeration
- Count the Number of Fair Pairs Two Pointers, Binary Search, Sorting
- Count of Interesting Subarrays Hash Table, Prefix Sum
- Maximum Sum of Almost Unique Subarray Hash Table, Sliding Window
- Count Subarrays Where Max Element Appears at Least K Times Sliding Window
- Continuous Subarrays Sliding Window, Monotonic Queue, Ordered Set
- Shortest Subarray to be Removed to Make Array Sorted Two Pointers, Binary Search, Monotonic Stack
- Maximum Sum Obtained of Any Permutation Greedy, Sorting, Prefix Sum
- Minimum Moves to Make Array Complementary Hash Table, Prefix Sum
- Ways to Split Array Into Three Subarrays Two Pointers, Binary Search, Prefix Sum
- Maximum Length of Subarray With Positive Product Dynamic Programming, Greedy
- Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Sliding Window, Monotonic Queue, Ordered Set
- Special Permutations Dynamic Programming, Bit Manipulation, Bitmask
- Substring XOR Queries Hash Table, String, Bit Manipulation
- Maximum Possible Number by Binary Concatenation Bit Manipulation, Enumeration
- Maximum Rows Covered by Columns Bit Manipulation, Matrix, Enumeration
- Smallest Subarrays With Maximum Bitwise OR Binary Search, Bit Manipulation, Sliding Window
- Largest Combination With Bitwise AND Greater Than Zero Hash Table, Bit Manipulation, Counting
- Prime Pairs With Target Sum Math, Enumeration, Number Theory
- Distinct Prime Factors of Product of Array Hash Table, Math, Number Theory
- Count Lattice Points Inside a Circle Hash Table, Math, Geometry
- Queries on Number of Points Inside a Circle Math, Geometry
- Maximum Number of Consecutive Values You Can Make Greedy, Sorting
- Four Divisors Math, Number Theory
- Smallest Range II Math, Greedy, Sorting
- Find the Substring With Maximum Cost Hash Table, String, Dynamic Programming
- Find the Divisibility Array of a String Math, String
- Minimum Amount of Time to Collect Garbage String, Prefix Sum
- Shifting Letters II String, Prefix Sum
- Longest Palindrome by Concatenating Two Letter Words Hash Table, String, Greedy
- Plates Between Candles String, Binary Search, Prefix Sum
- Number of Pairs of Strings With Concatenation Equal to Target Hash Table, String, Counting
- Print Words Vertically String, Simulation
- Compare Strings by Frequency of the Smallest Character Hash Table, String, Binary Search
- Reorder Data in Log Files String, Sorting
- Find And Replace in String Hash Table, String, Sorting
- Subdomain Visit Count Hash Table, String, Counting
- Expressive Words Two Pointers, String
- Minimum Time Difference Math, String, Sorting
- Optimal Division Math, Dynamic Programming
- Groups of Special-Equivalent Strings Hash Table, String, Sorting
- Sum of Distances Hash Table, Prefix Sum
- Find the Prefix Common Array of Two Arrays Hash Table, Bit Manipulation
- Find Score of an Array After Marking All Elements Hash Table, Sorting, Heap (Priority Queue)
- Maximize Greatness of an Array Two Pointers, Greedy, Sorting
- Count the Number of Beautiful Subarrays Hash Table, Bit Manipulation, Prefix Sum
- Rearrange Array to Maximize Prefix Score Greedy, Sorting, Prefix Sum
- Longest Square Streak in an Array Hash Table, Binary Search, Dynamic Programming
- Divide Players Into Teams of Equal Skill Hash Table, Two Pointers, Sorting
- Maximum Sum of Distinct Subarrays With Length K Hash Table, Sliding Window
- Number of Subarrays With LCM Equal to K Math, Number Theory
- Number of Subarrays With GCD Equal to K Math, Number Theory
- Minimize Maximum of Array Binary Search, Greedy, Prefix Sum
- Find All Good Indices Dynamic Programming, Prefix Sum
- Check if There is a Valid Partition For The Array Dynamic Programming
- Task Scheduler II Hash Table, Simulation
- Maximum Number of Groups Entering a Competition Math, Binary Search, Greedy
- Replace Elements in an Array Hash Table, Simulation
- Minimum Lines to Represent a Line Chart Math, Geometry, Sorting
- Maximum Bags With Full Capacity of Rocks Greedy, Sorting
- Number of Ways to Split Array Prefix Sum
- Minimum Average Difference Prefix Sum
- Minimum Rounds to Complete All Tasks Hash Table, Greedy, Counting
- Partition Array According to Given Pivot Two Pointers, Simulation
- Find All Lonely Numbers in the Array Hash Table, Counting
- Minimum Operations to Make a Uni-Value Grid Math, Sorting, Matrix
- Grid Game Matrix, Prefix Sum
- Maximum Alternating Subsequence Sum Dynamic Programming
- Reduction Operations to Make the Array Elements Equal Sorting
- Minimum Elements to Add to Form a Given Sum Greedy
- Maximum Absolute Sum of Any Subarray Dynamic Programming, Prefix Sum
- Tuple with Same Product Hash Table, Counting
- Count Good Meals Hash Table
- Sum of Absolute Differences in a Sorted Array Math, Prefix Sum
- Ways to Make a Fair Array Prefix Sum
- Make Sum Divisible by P Hash Table, Prefix Sum
- Number of Sub-arrays With Odd Sum Math, Dynamic Programming, Prefix Sum
- K-Concatenation Maximum Sum Dynamic Programming
- Maximum Subarray Sum with One Deletion Dynamic Programming
- Decrease Elements To Make Array Zigzag Greedy
- Maximum Sum of Two Non-Overlapping Subarrays Dynamic Programming, Sliding Window, Prefix Sum
- Minimum Domino Rotations For Equal Row Greedy
- Previous Permutation With One Swap Greedy
- Pairs of Songs With Total Durations Divisible by 60 Hash Table, Counting
- Array of Doubled Pairs Hash Table, Greedy, Sorting
- Minimum Increment to Make Array Unique Greedy, Sorting, Counting
- Friends Of Appropriate Ages Counting, Sorting
- Global and Local Inversions Math
- Array Nesting Depth-First Search
- Minimum Number of Increments on Subarrays to Form a Target Array Greedy, Dynamic Programming, Stack
- Find the Winner of an Array Game Simulation
- Queries on a Permutation With Key Binary Indexed Tree, Simulation
- Corporate Flight Bookings Prefix Sum
- Find the Winner of the Circular Game Math, Recursion, Simulation
- Longest Subsequence With Limited Sum Binary Search, Greedy, Sorting
- Partition Array for Maximum Sum Dynamic Programming
- Stone Game VII Math, Dynamic Programming, Game Theory
- Minimum Number of Work Sessions to Finish the Tasks Dynamic Programming, Bit Manipulation, Bitmask
- Count Fertile Pyramids in a Land Dynamic Programming, Matrix
- Count Ways to Group Overlapping Ranges Sorting, Math
- Find the Integer Added to Array II Two Pointers, Sorting, Enumeration
- Minimum Operations to Exceed Threshold Value II Heap (Priority Queue), Simulation
- Sum of Digit Differences of All Pairs Hash Table, Math, Counting
- Alternating Groups II Sliding Window
- Minimum Sum of Mountain Triplets II Prefix Sum
- Count Days Without Meetings Sorting
- Determine the Minimum Sum of a k-avoiding Array Math, Greedy
- Find the Value of the Partition Sorting
- Maximum Value of an Ordered Triplet II Prefix Sum
- Process Tasks Using Servers Simulation, Heap (Priority Queue)
- Maximum Number of Eaten Apples Greedy, Heap (Priority Queue)
- K-th Smallest Prime Fraction Binary Search, Sorting, Heap (Priority Queue)
- Find K Pairs with Smallest Sums Heap (Priority Queue)
- Maximum Subsequence Score Greedy, Sorting, Heap (Priority Queue)
- Total Cost to Hire K Workers Two Pointers, Simulation, Heap (Priority Queue)
- Single-Threaded CPU Sorting, Heap (Priority Queue)
- Most Beautiful Item for Each Query Binary Search, Sorting
- Number of Orders in the Backlog Simulation, Heap (Priority Queue)
- Maximum Number of Events That Can Be Attended Greedy, Sorting, Heap (Priority Queue)
- The Number of the Smallest Unoccupied Chair Hash Table, Heap (Priority Queue), Ordered Set
- Maximal Score After Applying K Operations Greedy, Heap (Priority Queue)
- Find the Kth Largest Integer in the Array String, Sorting, Heap (Priority Queue)
- Minimum Cost to Connect Sticks Greedy, Heap (Priority Queue)
- Find the Safest Path in a Grid Matrix, Binary Search, Breadth-First Search
- Detonate the Maximum Bombs Math, Graph, Depth-First Search
- The Maze II Matrix, Graph, Breadth-First Search
- Open the Lock String, Breadth-First Search
- Loud and Rich Graph, Topological Sort, Depth-First Search
- Maximum Star Sum of a Graph Graph, Greedy, Sorting
- Reachable Nodes With Restrictions Tree, Graph, Depth-First Search
- Largest Plus Sign Matrix, Dynamic Programming
- Remove All Ones With Row and Column Flips Matrix, Bit Manipulation
- Number of Corner Rectangles Matrix, Math, Dynamic Programming
- Magic Squares In Grid Matrix, Simulation
- Maximum Number of Fish in a Grid Matrix, Depth-First Search, Breadth-First Search
- Construct Product Matrix Matrix, Prefix Sum
- Maximum Number of Moves in a Grid Matrix, Dynamic Programming, Breadth-First Search
- Map of Highest Peak Matrix, Breadth-First Search
- Convert an Array Into a 2D Array With Conditions Matrix, Hash Table
- Check Knight Tour Configuration Matrix, Depth-First Search, Simulation
- First Completely Painted Row or Column Matrix, Hash Table
- Rotating the Box Matrix, Two Pointers, Simulation
- Find All Groups of Farmland Matrix, Depth-First Search, Breadth-First Search
- Matrix Block Sum Matrix, Prefix Sum
- Spiral Matrix III Matrix, Simulation
- Where Will the Ball Fall Matrix, Simulation, Depth-First Search
- Maximum Matrix Sum Matrix, Greedy
- Difference Between Ones and Zeros in Row and Column Matrix, Simulation
- Find the N-th Value After K Seconds Math, Simulation, Prefix Sum
- Minimum Cost Tree From Leaf Values Dynamic Programming, Stack, Monotonic Stack
- The Number of Beautiful Subsets Hash Table, Dynamic Programming, Backtracking
- Stone Game II Dynamic Programming, Prefix Sum, Game Theory
- Predict the Winner Dynamic Programming, Recursion, Game Theory
- Count Alternating Subarrays Math, Dynamic Programming
- Longest Arithmetic Subsequence Hash Table, Dynamic Programming, Binary Search
- Coin Change II Dynamic Programming
- Minimum Impossible OR Bit Manipulation, Brainteaser
- Stone Game IX Math, Greedy, Counting
- Minimum Operations to Make Median of Array Equal to K Greedy, Sorting
- Destroy Sequential Targets Hash Table, Counting
- Smallest Missing Non-negative Integer After Operations Hash Table, Math, Greedy
- Find the Maximum Number of Marked Indices Two Pointers, Greedy, Sorting
- Maximum Consecutive Floors Without Special Floors Sorting, Greedy
- Video Stitching Greedy, Dynamic Programming, Intervals
- Eliminate Maximum Number of Monsters Greedy, Sorting
- Removing Minimum and Maximum From Array Greedy
- Minimum Number of Operations to Move All Balls to Each Box String, Prefix Sum, Greedy
- Minimum Number of Arrows to Burst Balloons Greedy, Sorting, Intervals
- Maximum Number of Removable Characters String, Binary Search, Two Pointers
- Divide Chocolate Binary Search, Greedy
- Successful Pairs of Spells and Potions Binary Search, Sorting, Two Pointers
- Search a 2D Matrix II Matrix, Binary Search, Divide and Conquer
- Find Right Interval Binary Search, Sorting
- House Robber IV Binary Search, Greedy
- Minimize the Maximum Difference of Pairs Binary Search, Greedy, Sorting
- Maximum Candies Allocated to K Children Binary Search
- Peak Index in a Mountain Array Binary Search
- H-Index II Binary Search
- Find the Smallest Divisor Given a Threshold Binary Search
- Find the Student That Will Replace the Chalk Binary Search, Prefix Sum, Simulation
- Minimum Limit of Balls in a Bag Binary Search
- Magnetic Force Between Two Balls Binary Search, Sorting, Greedy
- Minimum Number of Days to Make m Bouquets Binary Search
- Capacity to Ship Packages Within D Days Binary Search
- Find First and Last Position of Element in Sorted Array Binary Search
- Find Minimum in Rotated Sorted Array II Binary Search
- Search in Rotated Sorted Array II Binary Search
- Minimum Consecutive Cards to Pick Up Hash Table, Sliding Window
- Max Consecutive Ones II Sliding Window, Dynamic Programming
- Minimum Swaps to Group All 1's Together II Sliding Window
- Length of Longest Subarray With at Most K Frequency Hash Table, Sliding Window
- Maximum Beauty of an Array After Applying Operation Sliding Window, Sorting, Binary Search
- Count Complete Subarrays in an Array Hash Table, Sliding Window
- Number of Subarrays with Bounded Maximum Sliding Window, Two Pointers
- Count the Number of Good Subarrays Hash Table, Sliding Window, Counting
- Frequency of the Most Frequent Element Sliding Window, Greedy, Sorting
- K Radius Subarray Averages Sliding Window, Prefix Sum
- Maximum Points You Can Obtain from Cards Sliding Window, Prefix Sum
- Grumpy Bookstore Owner Sliding Window
- Sentence Similarity III String, Two Pointers
- Watering Plants II Two Pointers, Simulation
- Number of Subsequences That Satisfy the Given Sum Condition Two Pointers, Sorting, Binary Search
- The k Strongest Values in an Array Two Pointers, Sorting
- 3Sum With Multiplicity Hash Table, Two Pointers, Counting
- Most Profit Assigning Work Two Pointers, Greedy, Sorting
- Longest Mountain in Array Two Pointers, Dynamic Programming
- Partition Array Such That Maximum Difference Is K Greedy, Sorting, Two Pointers
- Sort Transformed Array Two Pointers, Math, Sorting
- Bag of Tokens Two Pointers, Greedy, Sorting
- Max Number of K-Sum Pairs Two Pointers, Hash Table, Sorting
- 4Sum Two Pointers, Sorting
- Maximum Distance Between a Pair of Values Two Pointers, Binary Search
- Maximum OR Bit Manipulation, Greedy, Prefix Sum
- Bitwise ORs of Subarrays Bit Manipulation, Dynamic Programming
- Longest Nice Subarray Bit Manipulation, Sliding Window
- UTF-8 Validation Bit Manipulation
- Maximum XOR for Each Query Bit Manipulation, Prefix Sum
- XOR Queries of a Subarray Bit Manipulation, Prefix Sum
- Decode XORed Permutation Bit Manipulation, Brainteaser
- Find the Xor-Beauty of Array Bit Manipulation, Math, Brainteaser
- Maximum XOR After Operations Bit Manipulation, Brainteaser
- Longest Subarray With Maximum Bitwise AND Bit Manipulation, Brainteaser
- Minimum Number of Operations to Make Array XOR Equal to K Bit Manipulation
- Find The Original Array of Prefix Xor Bit Manipulation, Prefix Sum
- Bitwise XOR of All Pairings Bit Manipulation, Brainteaser
- Minimum Time to Repair Cars Binary Search, Greedy
- Maximum Value of an Ordered Triplet I Math, Prefix Sum
- Maximum Product After K Increments Greedy, Heap
- Prime Subtraction Operation Math, Greedy, Number Theory
- Number of Zero-Filled Subarrays Math, Counting
- 4Sum II Hash Table, Counting
- Find Players With Zero or One Losses Hash Table, Sorting, Counting
- Minimum Area Rectangle Hash Table, Geometry
- Number of Boomerangs Hash Table, Math
- Group the People Given the Group Size They Belong To Hash Table, Greedy
- Count Number of Bad Pairs Hash Table, Counting
- Brick Wall Hash Table, Counting
- Number of Pairs of Interchangeable Rectangles Hash Table, Math, Counting
- Count Nice Pairs in an Array Hash Table, Math, Counting
- Maximum Size Subarray Sum Equals k Hash Table, Prefix Sum
- Longest Well-Performing Interval Hash Table, Prefix Sum, Stack
- Subarray Sums Divisible by K Hash Table, Prefix Sum
- Count Triplets With Sum Smaller Than X Two Pointers, Sorting
- Kth Smallest Element Sorting, Quickselect
- Maximum Index Two Pointers
- Rearrange Array in Max/Min Form Two Pointers
- Subarray With Given Sum Sliding Window, Two Pointers
- Longest Subarray With Sum Zero Hash Table, Prefix Sum
- Minimum Swaps to Sort Sorting, Graph
- Count Inversions Divide and Conquer, Fenwick Tree
- Divide Array Into Arrays With Max Difference Greedy, Sorting
- Count Number of Teams Dynamic Programming
- Uncrossed Lines Dynamic Programming
- Paint House Dynamic Programming
- Find Original Array From Doubled Array Greedy, Sorting, Hash Table
- K-diff Pairs in an Array Hash Table
- Non-decreasing Array Greedy
- Minimum Moves to Equal Array Elements II Math, Sorting
- Minimum Moves to Equal Array Elements Math
- Word Search String, Backtracking, Depth-First Search
- Pacific Atlantic Water Flow Depth-First Search, Breadth-First Search, Matrix
- Snakes and Ladders Breadth-First Search, Matrix
- Jump Game III Depth-First Search, Breadth-First Search
- Path With Minimum Effort Binary Search, Depth-First Search, Breadth-First Search
- Detect Cycles in 2D Grid Depth-First Search, Breadth-First Search, Union Find
- Number of Distinct Islands Hash Table, Depth-First Search, Breadth-First Search
- Shortest Bridge Depth-First Search, Breadth-First Search, Matrix
- The Earliest Moment When Everyone Become Friends Union Find, Sorting
- Count Sub Islands Depth-First Search, Breadth-First Search, Union Find
- As Far from Land as Possible Dynamic Programming, Breadth-First Search, Matrix
- Shortest Path in Binary Matrix Breadth-First Search, Matrix
- Number of Enclaves Depth-First Search, Breadth-First Search, Union Find
- Rotate Function Math, Dynamic Programming
- Count Triplets That Can Form Two Arrays of Equal XOR Hash Table, Math, Bit Manipulation
- Maximum Product of Word Lengths String, Bit Manipulation
- Maximum XOR of Two Numbers in an Array Hash Table, Bit Manipulation, Trie
- Total Hamming Distance Math, Bit Manipulation
- Single Number III Bit Manipulation
- Single Number II Bit Manipulation
- Buildings With an Ocean View Stack, Monotonic Stack
- The Number of Weak Characters in the Game Greedy, Sorting, Stack
- Max Chunks To Make Sorted Stack, Greedy, Monotonic Stack
- Sum of Subarray Ranges Stack, Monotonic Stack
- Reveal Cards In Increasing Order Queue, Sorting, Simulation
- Validate Stack Sequences Stack, Simulation
- Maximum Width Ramp Stack, Monotonic Stack, Two Pointers
- 132 Pattern Binary Search, Stack, Monotonic Stack
- Sum of Subarray Minimums Dynamic Programming, Stack, Monotonic Stack
- Build an Array With Stack Operations Stack, Simulation
- Minimum Number of Platforms Greedy, Sorting, Two Pointers
- Find K Closest Elements Two Pointers, Binary Search, Sorting
- Kth Smallest Element in a Sorted Matrix Binary Search, Sorting, Heap
- Top K Frequent Words Hash Table, String, Sorting
- K Closest Points to Origin Math, Divide and Conquer, Geometry
- Partition Array into Disjoint Intervals Greedy
- Minimum Time to Make Rope Colorful String, Dynamic Programming, Greedy
- Valid Triangle Number Two Pointers, Binary Search, Greedy
- Rearrange Array Elements by Sign Two Pointers, Simulation
- Maximum Number of Coins You Can Get Math, Greedy, Sorting
- Largest Number String, Greedy, Sorting
- Maximum Ice Cream Bars Greedy, Sorting, Counting Sort
- Remove Covered Intervals Greedy, Sorting
- Reduce Array Size to The Half Hash Table, Greedy, Sorting
- Queue Reconstruction by Height Greedy, Sorting, Binary Indexed Tree
- Two City Scheduling Greedy, Sorting
- Maximum Length of Pair Chain Dynamic Programming, Greedy, Sorting
- Longest Turbulent Subarray Dynamic Programming, Sliding Window
- Best Sightseeing Pair Dynamic Programming
- Maximum Sum Circular Subarray Divide and Conquer, Dynamic Programming, Queue
- Minimum Cost For Tickets Dynamic Programming
- Longest String Chain Hash Table, Two Pointers, String
- Combination Sum IV Dynamic Programming
- Ones and Zeroes String, Dynamic Programming
- Last Stone Weight II Dynamic Programming
- Stone Game Math, Dynamic Programming, Game Theory
- Triangle Dynamic Programming
- Minimum Falling Path Sum Dynamic Programming, Matrix
- Arithmetic Slices Dynamic Programming
- Wiggle Subsequence Dynamic Programming, Greedy
- Number of Longest Increasing Subsequence Dynamic Programming, Binary Indexed Tree
- Longest Arithmetic Subsequence of Given Difference Hash Table, Dynamic Programming
- Maximum Length of Repeated Subarray Binary Search, Dynamic Programming, Sliding Window
- Best Time to Buy and Sell Stock with Transaction Fee Dynamic Programming, Greedy
- Best Time to Buy and Sell Stock with Cooldown Dynamic Programming
- Delete and Earn Hash Table, Dynamic Programming
- Valid Sudoku Hash Table, Matrix
- Count Servers that Communicate Depth-First Search, Breadth-First Search, Union Find
- Number of Closed Islands Depth-First Search, Breadth-First Search, Union Find
- Surrounded Regions Depth-First Search, Breadth-First Search, Union Find
- Game of Life Matrix, Simulation
- Count Square Submatrices with All Ones Dynamic Programming, Matrix
- Maximal Square Dynamic Programming, Matrix
- Unique Paths II Dynamic Programming, Matrix
- Minimum Path Sum Dynamic Programming, Matrix
- Sort the Matrix Diagonally Sorting, Matrix
- Max Increase to Keep City Skyline Greedy, Matrix
- Diagonal Traverse Matrix, Simulation
- Spiral Matrix II Matrix, Simulation
- Remove Duplicates from Sorted Array II Two Pointers
- Count Number of Nice Subarrays Hash Table, Math, Sliding Window
- Binary Subarrays With Sum Hash Table, Sliding Window, Prefix Sum
- Maximum Erasure Value Hash Table, Sliding Window
- Minimum Operations to Reduce X to Zero Hash Table, Binary Search, Sliding Window
- Longest Subarray of 1's After Deleting One Element Dynamic Programming, Sliding Window
- Continuous Subarray Sum Hash Table, Math, Prefix Sum
- Contiguous Array Hash Table, Prefix Sum
- Subarray Product Less Than K Sliding Window, Binary Search, Prefix Sum
- Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Sliding Window
- Majority Element II Hash Table, Sorting, Counting
- Increasing Triplet Subsequence Greedy
- H-Index Sorting, Counting Sort
- Shortest Unsorted Continuous Subarray Two Pointers, Sorting, Monotonic Stack
- Next Permutation Two Pointers
- Find All Duplicates in an Array Hash Table
- Combination Sum Backtracking
- Permutations Backtracking
- Subsets Backtracking, Bit Manipulation
- 3Sum Closest Two Pointers, Sorting
- 3Sum Two Pointers, Sorting
- Car Pooling Prefix Sum, Intervals, Sorting
- Interval List Intersections Two Pointers, Intervals
- Minimum Number of Arrows to Burst Balloons Greedy, Sorting, Intervals
- Meeting Rooms II Sorting, Heap, Intervals
- Non-overlapping Intervals Greedy, Sorting, Intervals
- Insert Interval Intervals
- Merge Intervals Sorting, Intervals
- 01 Matrix Matrix, Breadth-First Search, Dynamic Programming
- Rotting Oranges Matrix, Breadth-First Search
- Max Area of Island Matrix, Depth-First Search
- Number of Islands Matrix, Depth-First Search, Breadth-First Search
- Search a 2D Matrix Matrix, Binary Search
- Set Matrix Zeroes Matrix, Hash Table
- Spiral Matrix Matrix, Simulation
- Rotate Image Matrix, Math
- Furthest Building You Can Reach Heap, Greedy
- Least Number of Unique Integers after K Removals Heap, Greedy, Hash Table
- Sort an Array Sorting, Heap, Divide and Conquer
- Top K Frequent Elements Heap, Hash Table, Bucket Sort
- Kth Largest Element in an Array Heap, Quickselect, Sorting
- Target Sum Dynamic Programming, Backtracking
- Partition Equal Subset Sum Dynamic Programming
- Longest Increasing Subsequence Dynamic Programming, Binary Search
- Coin Change II Dynamic Programming
- Coin Change Dynamic Programming, Breadth-First Search
- House Robber II Dynamic Programming
- House Robber Dynamic Programming
- Task Scheduler Greedy, Heap, Counting
- Boats to Save People Greedy, Two Pointers, Sorting
- Best Time to Buy and Sell Stock II Greedy, Dynamic Programming
- Hand of Straights Greedy, Hash Table, Sorting
- Gas Station Greedy
- Jump Game II Greedy, Dynamic Programming
- Jump Game Greedy, Dynamic Programming
- Car Fleet Stack, Sorting, Monotonic Stack
- Asteroid Collision Stack, Simulation
- Next Greater Element II Stack, Monotonic Stack
- Daily Temperatures Stack, Monotonic Stack
- Evaluate Reverse Polish Notation Stack, Math
- Single Element in a Sorted Array Binary Search
- Capacity To Ship Packages Within D Days Binary Search, Greedy
- Koko Eating Bananas Binary Search
- Find First and Last Position of Element in Sorted Array Binary Search
- Find Peak Element Binary Search
- Find Minimum in Rotated Sorted Array Binary Search
- Search in Rotated Sorted Array Binary Search
- Sort Colors Two Pointers, Sorting
- Fruit Into Baskets Sliding Window, Hash Table
- Max Consecutive Ones III Sliding Window, Binary Search
- Minimum Size Subarray Sum Sliding Window, Prefix Sum
- Container With Most Water Two Pointers, Greedy
- Two Sum II - Input Array Is Sorted Two Pointers, Binary Search
- Find the Duplicate Number Two Pointers, Binary Search
- Longest Consecutive Sequence Hash Table, Union Find
- Subarray Sum Equals K Hash Table, Prefix Sum
- Maximum Product Subarray Dynamic Programming
- Rotate Array Math, Two Pointers
- Product of Array Except Self Prefix Sum
- Maximum Subarray Dynamic Programming, Divide and Conquer
Hard (246)
- Design Movie Rental System Hash Table, Heap (Priority Queue), Ordered Set
- Prefix and Suffix Search Hash Table, String, Design
- Height of Binary Tree After Subtree Removal Queries Tree, Depth-First Search, Breadth-First Search
- Stamping the Grid Greedy, Matrix, Prefix Sum
- Maximum Number of Ways to Partition an Array Hash Table, Counting, Enumeration
- Smallest Rotation with Highest Score Prefix Sum
- Sum of Imbalance Numbers of All Subarrays Hash Table, Ordered Set
- Maximum Equal Frequency Hash Table, Counting
- Number of Subarrays That Match a Pattern II Rolling Hash, String Matching
- GCD Sort of an Array Math, Union Find, Sorting
- Rank Transform of a Matrix Union Find, Graph, Topological Sort
- Last Day Where You Can Still Cross Binary Search, Depth-First Search, Breadth-First Search
- Bricks Falling When Hit Union Find, Matrix
- Shortest Distance After Road Addition Queries II Graph, Ordered Set
- Minimum Edge Weight Equilibrium Queries in a Tree Tree, Graph
- Minimize the Total Price of the Trips Dynamic Programming, Tree, Depth-First Search
- Minimum Number of Visited Cells in a Grid Dynamic Programming, Stack, Breadth-First Search
- Minimum Reverse Operations Breadth-First Search, Ordered Set, Union Find
- Collect Coins in a Tree Tree, Graph, Topological Sort
- Create Components With Same Value Math, Tree, Depth-First Search
- Minimum Score After Removals on a Tree Bit Manipulation, Tree, Depth-First Search
- Maximum Score of a Node Sequence Graph, Sorting, Enumeration
- Strange Printer II Graph, Topological Sort, Matrix
- Maximum Candies You Can Get from Boxes Breadth-First Search, Graph
- Minimum Number of Flips to Convert Binary Matrix to Zero Matrix Hash Table, Bit Manipulation, Breadth-First Search
- Minimum Moves to Move a Box to Their Target Location Breadth-First Search, Heap (Priority Queue), Matrix
- Escape a Large Maze Hash Table, Depth-First Search, Breadth-First Search
- Minimize Malware Spread II Hash Table, Depth-First Search, Breadth-First Search
- Contain Virus Depth-First Search, Breadth-First Search, Matrix
- Cut Off Trees for Golf Event Breadth-First Search, Heap (Priority Queue), Matrix
- Length of Longest V-Shaped Diagonal Segment Dynamic Programming, Memoization, Matrix
- Sum of Good Subsequences Hash Table, Dynamic Programming
- Find the Number of Subsequences With Equal GCD Math, Dynamic Programming, Number Theory
- Find the Maximum Sequence Value of Array Dynamic Programming, Bit Manipulation
- Maximum XOR Score Subarray Queries Dynamic Programming
- Select Cells in Grid With Maximum Score Dynamic Programming, Bit Manipulation, Matrix
- Find the Count of Monotonic Pairs I Math, Dynamic Programming, Combinatorics
- Find the Maximum Length of a Good Subsequence II Hash Table, Dynamic Programming
- Minimum Sum of Values by Dividing Array Binary Search, Dynamic Programming, Bit Manipulation
- Find the Sum of Subsequence Powers Dynamic Programming, Sorting
- Find the Sum of the Power of All Subsequences Dynamic Programming
- Maximize Consecutive Elements in an Array After Modification Dynamic Programming, Sorting
- Find Maximum Non-decreasing Array Length Binary Search, Dynamic Programming, Stack
- Maximum Points After Collecting Coins From All Nodes Dynamic Programming, Bit Manipulation, Tree
- Count of Sub-Multisets With Bounded Sum Hash Table, Dynamic Programming, Sliding Window
- Maximum Strictly Increasing Cells in a Matrix Hash Table, Binary Search, Dynamic Programming
- Count Increasing Quadruplets Dynamic Programming, Binary Indexed Tree, Enumeration
- Minimum Total Distance Traveled Dynamic Programming, Sorting
- Substring With Largest Variance Dynamic Programming
- Check if There Is a Valid Parentheses String Path Dynamic Programming, Matrix
- Maximum Number of Groups Getting Fresh Donuts Dynamic Programming, Bit Manipulation, Memoization
- Make the XOR of All Segments Equal to Zero Dynamic Programming, Bit Manipulation
- Delivering Boxes from Storage to Ports Dynamic Programming, Segment Tree, Queue
- Minimum Number of Removals to Make Mountain Array Binary Search, Dynamic Programming, Greedy
- Minimum Cost to Connect Two Groups of Points Dynamic Programming, Bit Manipulation, Matrix
- Word Wrap Dynamic Programming
- Matrix Chain Multiplication Dynamic Programming
- Remove Boxes Dynamic Programming, Memoization
- Number of Squareful Arrays Math, Backtracking, Bitmask
- Closest Subsequence Sum Two Pointers, Bitmask, Sorting
- Maximum Number of Achievable Transfer Requests Backtracking, Bit Manipulation, Enumeration
- 24 Game Math, Backtracking
- Verbal Arithmetic Puzzle Math, String, Backtracking
- Distribute Repeating Integers Backtracking, Bitmask, Dynamic Programming
- Sudoku Solver Hash Table, Backtracking, Matrix
- Shortest Path in a Grid with Obstacles Elimination Breadth-First Search, Matrix
- Transform to Chessboard Math, Bit Manipulation, Matrix
- Minimum Moves to Reach Target with Rotations Breadth-First Search, Matrix
- Number of Paths with Max Score Dynamic Programming, Matrix
- Max Sum of Rectangle No Larger Than K Binary Search, Matrix, Ordered Set
- Shortest Path to Get All Keys Bit Manipulation, Breadth-First Search, Matrix
- Minimize Malware Spread Hash Table, Graph, Union Find
- Similar String Groups Hash Table, String, Union Find
- Longest Path With Different Adjacent Characters String, Tree, Depth-First Search
- Parallel Courses III Graph, Topological Sort, Dynamic Programming
- Selling Pieces of Wood Dynamic Programming, Memoization
- Minimum Operations to Make the Array K-Increasing Binary Search, Dynamic Programming
- Count Number of Special Subsequences Dynamic Programming
- Minimum Skips to Arrive at Meeting On Time Dynamic Programming
- Number of Ways to Form a Target String Given a Dictionary String, Dynamic Programming
- Count All Possible Routes Dynamic Programming, Memoization
- Paint House III Dynamic Programming
- Number of Ways of Cutting a Pizza Dynamic Programming, Matrix, Prefix Sum
- Pizza With 3n Slices Dynamic Programming, Greedy, Heap (Priority Queue)
- Jump Game V Dynamic Programming, Sorting
- Maximum Profit in Job Scheduling Binary Search, Dynamic Programming, Sorting
- Dice Roll Simulation Dynamic Programming
- Stone Game V Math, Dynamic Programming, Game Theory
- Minimum Cost to Merge Stones Dynamic Programming, Prefix Sum
- Maximum Sum of 3 Non-Overlapping Subarrays Dynamic Programming, Prefix Sum, Sliding Window
- Arithmetic Slices II - Subsequence Dynamic Programming, Hash Table
- Minimum Swaps To Make Sequences Increasing Dynamic Programming
- Maximum Score from Performing Multiplication Operations Dynamic Programming
- Maximum Score Of Spliced Array Dynamic Programming
- Minimum Operations to Form Subsequence With Target Sum Greedy, Bit Manipulation
- Rearranging Fruits Hash Table, Greedy, Sorting
- Minimum Number of Operations to Make Arrays Similar Greedy, Sorting
- Partition Array Into Two Arrays to Minimize Sum Difference Binary Search, Bit Manipulation, Bitmask
- Minimum Initial Energy to Finish Tasks Greedy, Sorting
- Delete Columns to Make Sorted III String, Dynamic Programming
- Create Maximum Number Greedy, Stack, Monotonic Stack
- Patching Array Greedy
- Minimum Deletions to Make Array Divisible Math, Sorting, Number Theory
- Minimum Time to Finish the Race Dynamic Programming
- Set Intersection Size At Least Two Greedy, Sorting
- Kth Smallest Instructions Math, Dynamic Programming, Combinatorics
- Minimum Amount of Damage Dealt to Bob Greedy, Sorting
- Maximum Spending After Buying Items Greedy, Sorting, Heap (Priority Queue)
- Earliest Possible Day of Full Bloom Greedy, Sorting
- Minimum Difference in Sums After Removal of Elements Dynamic Programming, Heap (Priority Queue)
- Maximum Number of Points From Grid Queries Breadth-First Search, Matrix, Heap (Priority Queue)
- Course Schedule III Greedy, Sorting, Heap (Priority Queue)
- Minimum Interval to Include Each Query Binary Search, Sorting, Heap (Priority Queue)
- The Skyline Problem Divide and Conquer, Heap (Priority Queue), Ordered Set
- Maximum of Minimum for Every Window Size Stack, Monotonic Stack, Sliding Window
- Find the Number of Subarrays Where Boundary Elements Are Maximum Binary Search, Stack, Monotonic Stack
- Robot Collisions Stack, Sorting, Simulation
- Max Chunks To Make Sorted II Stack, Greedy, Monotonic Stack
- Replace Non-Coprime Numbers in Array Math, Stack, Number Theory
- Sum of Total Strength of Wizards Stack, Monotonic Stack, Prefix Sum
- Maximum Score of a Good Subarray Two Pointers, Stack, Monotonic Stack
- Next Greater Element IV Stack, Monotonic Stack, Sorting
- Maximum Sum Queries Binary Search, Sorting, Monotonic Stack
- Minimum Operations to Make a Subsequence Hash Table, Binary Search, Greedy
- Find Building Where Alice and Bob Can Meet Binary Search, Monotonic Stack, Heap (Priority Queue)
- Longest Increasing Subsequence II Dynamic Programming, Segment Tree, Divide and Conquer
- Minimum Cost to Make Array Equal Binary Search, Greedy, Sorting
- Maximize the Minimum Powered City Binary Search, Greedy, Prefix Sum
- Number of Flowers in Full Bloom Binary Search, Sorting, Prefix Sum
- Kth Smallest Product of Two Sorted Arrays Binary Search, Two Pointers
- Apply Operations to Maximize Frequency Score Sliding Window, Sorting, Prefix Sum
- Maximum Fruits Harvested After at Most K Steps Binary Search, Sliding Window, Prefix Sum
- Count Subarrays With Score Less Than K Binary Search, Sliding Window, Prefix Sum
- Count Subarrays With Median K Hash Table, Prefix Sum
- Number of Ways to Wear Different Hats to Each Other Dynamic Programming, Bit Manipulation, Bitmask
- Minimum XOR Sum of Two Arrays Dynamic Programming, Bit Manipulation, Bitmask
- Number of Subarrays With AND Value of K Binary Search, Bit Manipulation, Segment Tree
- Apply Operations on Array to Maximize Sum of Squares Hash Table, Greedy, Bit Manipulation
- Count Prefix and Suffix Pairs II String, Trie, Rolling Hash
- Maximum Strong Pair XOR II Bit Manipulation, Trie, Sliding Window
- Number of Excellent Pairs Hash Table, Binary Search, Bit Manipulation
- Maximum Score Words Formed by Letters String, Backtracking, Bitmask
- Triples with Bitwise AND Equal To Zero Hash Table, Bit Manipulation
- Maximum XOR With an Element From Array Bit Manipulation, Trie, Sorting
- Count Pairs With XOR in a Range Bit Manipulation, Trie
- Find XOR Sum of All Pairs Bitwise AND Math, Bit Manipulation
- Sum of Floored Pairs Math, Binary Search, Prefix Sum
- Self Crossing Math, Geometry
- Erect the Fence Math, Geometry
- Perfect Rectangle Hash Table, Math, Geometry
- Rectangle Area II Math, Geometry, Sorting
- Palindrome Pairs Hash Table, String, Trie
- Length of the Longest Valid Substring Hash Table, String, Sliding Window
- Sum of Prefix Scores of Strings String, Trie, Counting
- Text Justification String, Simulation
- Count Ways to Make Array With Product Math, Dynamic Programming, Combinatorics
- The Number of Good Subsets Math, Dynamic Programming, Bit Manipulation
- Number of Ways to Reorder Array to Get Same BST Math, Divide and Conquer, Dynamic Programming
- Make Array Strictly Increasing Binary Search, Dynamic Programming, Sorting
- Odd Even Jump Dynamic Programming, Stack, Monotonic Stack
- Maximum Number of Events That Can Be Attended II Binary Search, Dynamic Programming, Sorting
- Minimum Replacements to Sort the Array Math, Greedy
- Create Sorted Array Through Instructions Binary Search, Divide and Conquer, Binary Indexed Tree
- Painting the Walls Dynamic Programming
- Reverse Pairs Binary Search, Divide and Conquer, Binary Indexed Tree
- Minimum Incompatibility Dynamic Programming, Bit Manipulation, Bitmask
- Form Largest Integer With Digits That Add up to Target String, Dynamic Programming
- Stone Game VIII Math, Dynamic Programming, Prefix Sum
- Allocate Mailboxes Math, Dynamic Programming, Sorting
- Constrained Subsequence Sum Dynamic Programming, Queue, Sliding Window
- Maximum Height by Stacking Cuboids Dynamic Programming, Sorting
- Cherry Pickup II Dynamic Programming, Matrix
- Maximum Value of K Coins From Piles Dynamic Programming, Prefix Sum
- Number of Great Partitions Dynamic Programming
- Minimum Cost to Split an Array Hash Table, Dynamic Programming, Counting
- Paths in Matrix Whose Sum Is Divisible by K Dynamic Programming, Matrix
- Apply Operations to Maximize Score Math, Stack, Greedy
- Meeting Rooms III Sorting, Simulation, Heap (Priority Queue)
- Smallest Range Covering Elements from K Lists Hash Table, Greedy, Sliding Window
- Minimize Deviation in Array Greedy, Heap (Priority Queue), Ordered Set
- Maximum Performance of a Team Greedy, Sorting, Heap (Priority Queue)
- Construct Target Array With Multiple Sums Heap (Priority Queue), Math
- Minimum Number of Operations to Make Array Continuous Hash Table, Binary Search, Sliding Window
- Put Marbles in Bags Greedy, Sorting, Heap (Priority Queue)
- Minimum Time to Visit a Cell In a Grid Matrix, Graph, Breadth-First Search
- Minimum Number of Days to Disconnect Island Matrix, Depth-First Search, Breadth-First Search
- Number of Increasing Paths in a Grid Matrix, Dynamic Programming, Depth-First Search
- Checking Existence of Edge Length Limited Paths Union Find, Graph, Sorting
- Minimum Obstacle Removal to Reach Corner Matrix, Graph, Breadth-First Search
- Number of Good Paths Tree, Graph, Union Find
- Largest Component Size by Common Factor Math, Union Find, Number Theory
- Bus Routes Hash Table, Breadth-First Search
- Sliding Puzzle Matrix, Breadth-First Search
- Jump Game IV Hash Table, Breadth-First Search
- Trapping Rain Water II Matrix, Heap (Priority Queue), Breadth-First Search
- Escape the Spreading Fire Matrix, Binary Search, Breadth-First Search
- Grid Illumination Hash Table, Matrix
- Shortest Distance from All Buildings Matrix, Breadth-First Search
- Minimum Moves to Spread Stones Over Grid Matrix, Dynamic Programming, Breadth-First Search
- Making A Large Island Matrix, Depth-First Search, Breadth-First Search
- Unique Paths III Matrix, Backtracking, Bit Manipulation
- Number of Submatrices That Sum to Target Matrix, Hash Table, Prefix Sum
- Longest Increasing Path in a Matrix Matrix, Dynamic Programming, Depth-First Search
- Maximal Rectangle Matrix, Stack, Dynamic Programming
- Minimum Difficulty of a Job Schedule Dynamic Programming
- Minimum Cost to Cut a Stick Dynamic Programming, Sorting
- Maximum Number of Groups With Increasing Length Greedy, Sorting, Binary Search
- Number of Ways to Earn Points Dynamic Programming
- Profitable Schemes Dynamic Programming
- Cherry Pickup Matrix, Dynamic Programming
- Tallest Billboard Dynamic Programming
- Best Time to Buy and Sell Stock IV Dynamic Programming
- Burst Balloons Dynamic Programming
- Frog Jump Hash Table, Dynamic Programming
- Minimum Falling Path Sum II Matrix, Dynamic Programming
- Dungeon Game Matrix, Dynamic Programming
- Minimum Time to Complete All Tasks Greedy, Sorting
- Minimum Number of Refueling Stops Greedy, Dynamic Programming, Heap
- IPO Greedy, Sorting, Heap
- Minimum Number of Taps to Open to Water a Garden Greedy, Dynamic Programming, Intervals
- Maximum Number of Tasks You Can Assign Binary Search, Greedy, Sorting
- Find the Kth Smallest Sum of a Matrix With Sorted Rows Matrix, Binary Search, Heap
- Russian Doll Envelopes Binary Search, Dynamic Programming, Sorting
- Maximum Running Time of N Computers Binary Search, Greedy, Sorting
- Minimum Time to Complete Trips Binary Search
- Split Array Largest Sum Binary Search, Greedy, Dynamic Programming
- Minimum Number of K Consecutive Bit Flips Sliding Window, Prefix Sum, Greedy
- Shortest Subarray with Sum at Least K Prefix Sum, Sliding Window, Monotonic Queue
- Count Subarrays With Fixed Bounds Sliding Window, Two Pointers, Queue
- Maximum Number of Robots Within Budget Sliding Window, Two Pointers, Queue
- Find K-th Smallest Pair Distance Two Pointers, Binary Search, Sorting
- Subarrays with K Different Integers Hash Table, Sliding Window, Two Pointers
- Find Subarray With Bitwise OR Closest to K Bit Manipulation, Binary Search, Segment Tree
- Largest Multiple of Three Greedy, Dynamic Programming, Math
- Max Value of Equation Monotonic Queue, Sliding Window
- Count of Smaller Numbers After Self Fenwick Tree, Divide and Conquer
- Stone Game III Dynamic Programming, Game Theory
- Max Dot Product Between Two Subsequences Dynamic Programming
- Swim in Rising Water Binary Search, Depth-First Search, Breadth-First Search
- Number of Visible People in a Queue Stack, Monotonic Stack
- Best Time to Buy and Sell Stock III Dynamic Programming
- Candy Greedy
- Largest Rectangle in Histogram Stack, Monotonic Stack
- Sliding Window Maximum Sliding Window, Monotonic Queue, Heap
- Trapping Rain Water Two Pointers, Dynamic Programming, Stack
- First Missing Positive Hash Table
Companies that ask arrays problems
- Amazon 1024 problems on arrays
- Google 785 problems on arrays
- Microsoft 206 problems on arrays
- Adobe 117 problems on arrays
- Meta 108 problems on arrays
- TCS 66 problems on arrays
- Uber 47 problems on arrays
- Flipkart 43 problems on arrays
- Infosys 40 problems on arrays
- Bloomberg 32 problems on arrays
- Morgan Stanley 24 problems on arrays
- Atlassian 22 problems on arrays
Next topic: Strings