| 5 |
Longest Palindromic Substring |
Manacher's Algorithm |
Prefix Suffix |
| 17 |
Letter Combinations of a Phone Number |
Recursion |
Combinatorics |
| 20 |
Valid Parentheses |
Stack |
Stack |
| 23 |
Merge k Sorted Lists |
Priority Queue |
Priority Queue, Pointers |
| 24 |
Swap Nodes in Pairs |
Pointers |
Linked Lists |
| 28 |
Find the Index of the First Occurrence in a String |
KMP Substring |
Find Patterns |
| 33 |
Search in Rotated Sorted Array |
Modified Binary Search |
Search |
| 34 |
Find First and Last Position of Element in Sorted Array |
Binary Search |
Search |
| 38 |
Count and Say |
Iteration |
Implementation |
| 46 |
Permutations |
In-Built Function |
Combinatorics |
| 54 |
Spiral Matrix |
Indexing |
Arrays |
| 59 |
Spiral Matrix II |
Robot |
Arrays |
| 62 |
Unique Paths |
Dynamic Programming |
Maze Searching |
| 63 |
Unique Paths II |
Dynamic Programming |
Maze Searching |
| 64 |
Minimum Path Sum |
Dynamic Programming |
Path Searching |
| 68 |
Text Justification |
Iteration |
Strings |
| 71 |
Simplify Path |
Vector |
String Parsing |
| 72 |
Edit Distance |
> Dynamic Programming > Memoisation |
Recursion, Memoisation, Dynamic Programming |
| 74 |
Search a 2D Matrix |
Binary Search |
Searching |
| 75 |
Sort Colors |
Counting Sort |
Sorting |
| 77 |
Combinations |
Recursion |
Combinatorics |
| 81 |
Search in Rotated Sorted Array II |
Binary Search |
Search |
| 86 |
Partition List |
Pointers |
Linked Lists |
| 87 |
Scramble String |
Dynamic Programming |
Substrings |
| 92 |
Reverse Linked List II |
Pointers |
Linked Lists |
| 95 |
Unique Binary Search Trees II |
Dynamic Programming |
Combinatorics |
| 97 |
Interleaving String |
Memoisation |
Recursion |
| 101 |
Symmetric Tree |
Tree Traversal |
Tree Traversal |
| 106 |
Construct Binary Tree from Inorder and Postorder Traversal |
Recursion, Map |
Tree Traversal |
| 109 |
Convert Sorted List to Binary Search Tree |
> Vector > No Mid-Finding |
Linked Lists, Binary Trees |
| 118 |
Pascal's Triangle |
Iteration |
Iteration |
| 119 |
Pascal's Triangle II |
Dynamic Programming |
Iteration |
| 122 |
Best Time to Buy and Sell Stock II |
Greedy |
Problem Solving |
| 127 |
Word Ladder |
Bidirectional BFS |
Graph Traversal |
| 129 |
Sum Root to Leaf Numbers |
Recursion |
Binary Trees |
| 133 |
Clone Graph |
Adjacency List |
Undirected Graphs |
| 135 |
Candy |
Two Pass |
Problem Solving |
| 138 |
Copy List with Random Pointer |
Maps |
Linked Lists |
| 139 |
Word Break |
Memoisation |
Recursion |
| 141 |
Linked List Cycle |
Floyd's Cycle Finding |
Linked Lists |
| 142 |
Linked List Cycle II |
Floyd's Cycle Finding |
Linked Lists |
| 146 |
LRU Cache |
Hashed Doubly-Linked Lists |
Data Structures |
| 168 |
Excel Sheet Column Title |
Binary Conversion |
Bases |
| 175 |
Combine Two Tables |
Left Join |
Joins |
| 176 |
Second Highest Salary |
Max |
Max |
| 185 |
Department Top Three Salaries |
Dense Rank |
Dense Rank |
| 208 |
Implement Trie (Prefix Tree) |
Map |
Trie/Prefix Tree |
| 211 |
Design Add and Search Words Data Structure |
Trie/Prefix Tree |
Data Structures |
| 215 |
Kth Largest Element in an Array |
QuickSelect |
Sorting |
| 225 |
Implement Stack using Queues |
Double-Ended Queue |
Data Structures |
| 228 |
Summary Ranges |
Iteration |
Strings |
| 229 |
Majority Element II |
Boyer-Moore Majority Vote |
Majority |
| 238 |
Remove Colored Pieces if Both Neighbors are the Same Color |
Greedy |
Games |
| 239 |
Sliding Window Maximum |
Double Ended Queue |
Sliding Windows |
| 258 |
Add Digits |
Maths |
Maths |
| 262 |
Trips and Users |
GroupBy |
GroupBy |
| 316 |
Remove Duplicate Letters |
Greedy |
Data Structures |
| 319 |
Bulb Switcher |
Maths |
Maths |
| 330 |
Patching Array |
Greedy |
Integer Ranges |
| 338 |
Counting Bits |
Recursion |
Binary Numbers |
| 341 |
Flatten Nested List Iterator |
Stack |
Nested Lists |
| 342 |
Power of Four |
Maths |
Floats |
| 343 |
Integer Break |
Maths |
Maths |
| 347 |
Top K Frequent Elements |
Quickselect |
Selection |
| 350 |
Intersection of Two Arrays II |
Sets |
Sets |
| 373 |
Find K Pairs with Smallest Sums |
Priority Queue |
Permutations |
| 377 |
Combination Sum IV |
Dynamic Programming |
Data Types |
| 382 |
Linked List Random Node |
Reservoir Sampling |
Reservoir Sampling |
| 389 |
Find the Difference |
ASCII |
Data Types |
| 399 |
Evaluate Division |
Depth-First Search |
Graph Representation |
| 403 |
Frog Jump |
Memoisation |
Recursion |
| 429 |
Construct Quad Tree |
Recursion |
Recursion, Memory Allocation |
| 443 |
String Compression |
Iteration |
Array Looping |
| 458 |
Poor Pigs |
Tensors |
Problem Solving |
| 459 |
Repeated Substring Pattern |
Iteration |
Substrings |
| 474 |
Ones and Zeroes |
Dynamic Programming |
Knapsack |
| 502 |
IPO |
Greedy |
Problem Solving |
| 515 |
Find Largest Value in Each Tree Row |
DFS |
Binary Trees |
| 518 |
Coin Change II |
Recursion |
Recursion |
| 530 |
Minimum Absolute Difference in BST |
Recursion |
Tree Traversal |
| 542 |
01 Matrix |
Breadth-First Search |
Mazes |
| 547 |
Number of Provinces |
Union-Find |
Disjoint Sets |
| 557 |
Reverse Words in a String III |
Swap |
Strings |
| 601 |
Human Traffic of Stadium |
Gaps & Islands |
Consecutive |
| 605 |
Can Place Flowers |
Iteration |
Logic |
| 633 |
Sum of Square Numbers |
Two Pointers |
Integers |
| 646 |
Maximum Length of Pair Chain |
Greedy |
Problem Solving |
| 649 |
Dota2 Senate |
Greedy |
Data Structures |
| 652 |
Find Duplicate Subtrees |
Hashing |
Hashing, Binary Trees |
| 685 |
Redundant Connection II |
Union-Find |
Trees |
| 703 |
Kth Largest Element in a Stream |
Priority Queue |
Heap |
| 704 |
Binary Search |
Binary Search |
Array Searching |
| 705 |
Design HashSet |
Vector |
Hashing |
| 706 |
Design HashMap |
Vector |
Hashing |
| 714 |
Best Time to Buy and Sell Stock with Transaction Fee |
Iteration |
Iteration |
| 725 |
Split Linked List in Parts |
Pointers |
Linked Lists |
| 744 |
Find Smallest Letter Greater Than Target |
Binary Search |
Search |
| 746 |
Min Cost Climbing Stairs |
Dynamic Programming |
Dynamic Programming |
| 767 |
Reorganize String |
String Braiding |
Braiding |
| 779 |
K-th Symbol in Grammar |
Binary Tree |
Recursion |
| 781 |
Rabbits in Forest |
Counter |
Groupings |
| 785 |
Is Graph Bipartite? |
Recursion |
Graph Traversal |
| 799 |
Champagne Tower |
Physics |
Modelling |
| 823 |
Binary Trees With Factors |
Dynamic Programming |
Problem Solving |
| 826 |
Most Profit Assigning Work |
Greedy |
Allocation |
| 837 |
New 21 Game |
Dynamic Programming |
Problem Solving |
| 839 |
Similar String Groups |
Union-Find |
Disjoint Sets |
| 844 |
Backspace String Compare |
Pointers |
Strings |
| 864 |
Shortest Path to Get All Keys |
Breadth-First Search |
Mazes |
| 875 |
Koko Eating Bananas |
Binary Search |
Binary Search, Integer Overflow |
| 881 |
Boats to Save People |
Greedy |
Problem Solving |
| 896 |
Monotonic Array |
Iteration |
Arrays |
| 905 |
Sort Array By Parity |
Swap |
Arrays |
| 912 |
Sort an Array |
HeapSort |
Array Sorting |
| 920 |
Number of Music Playlists |
Combinatorics |
Modular Arithmetic |
| 934 |
Shortest Bridge |
Breadth-First Search |
Graphs |
| 945 |
Minimum Increment to Make Array Unique |
Sorting |
Problem Solving |
| 956 |
Tallest Billboard |
Dynamic Programming |
Problem Simplification |
| 958 |
Check Completeness of a Binary Tree |
Depth-First Search |
Binary Trees |
| 983 |
Minimum Cost For Tickets |
Dynamic Programming |
Logic |
| 995 |
Minimum Number of K Consecutive Bit Flips |
Bit-Wise |
Bits |
| 1020 |
Number of Enclaves |
Flood Fill |
Recursion |
| 1027 |
Longest Arithmetic Subsequence |
Hashmap |
Time Complexity |
| 1035 |
Uncrossed Lines |
Dynamic Programming |
Subsequences |
| 1038 |
Binary Search Tree to Greater Sum Tree |
Recursion |
Tree Traversal |
| 1048 |
Longest String Chain |
Dynamic Programming |
Substrings |
| 1052 |
Grumpy Bookstore Owner |
Sliding Window |
Iteration |
| 1091 |
Shortest Path in Binary Matrix |
Breadth-First Search |
Search |
| 1095 |
Find in Mountain Array |
Binary Search |
Sorted Arrays |
| 1139 |
Largest 1-Bordered Square |
Pre-Count |
Problem Solving |
| 1140 |
Stone Game II |
Memoisation |
Problem Solving |
| 1144 |
Number of Ways of Cutting a Pizza |
Dynamic Programming |
Problem Solving |
| 1146 |
Snapshot Array |
Changelog |
Version Control |
| 1161 |
Maximum Level Sum of a Binary Tree |
Breadth-First Search |
Tree Traversal |
| 1187 |
Make Array Strictly Increasing |
Memoisation |
Games |
| 1203 |
Sort Items by Groups Respecting Dependencies |
Topological Sort |
Ordering |
| 1220 |
Count Vowels Permutation |
Dynamic Programming |
Problem Solving |
| 1232 |
Check If It Is a Straight Line |
Slope |
Geometry |
| 1248 |
Count Number of Nice Subarrays |
Sliding Window |
Iteration |
| 1254 |
Number of Closed Islands |
Flood Fill |
Recursion |
| 1269 |
Number of Ways to Stay in the Same Place After Some Steps |
Dynamic Programming |
Problem Solving |
| 1282 |
Group the People Given the Group Size They Belong To |
Greedy |
Problem Solving |
| 1318 |
Minimum Flips to Make a OR b Equal to c |
Bitwise |
Bitwise Operations |
| 1319 |
Number of Operations to Make Network Connected |
> Union-Find >Depth-First Search |
Disjoint Sets |
| 1326 |
Minimum Number of Taps to Open to Water a Garden |
Greedy |
Caching |
| 1345 |
Jump Game IV |
Breadth-First Search |
Path Finding |
| 1351 |
Count Negative Numbers in a Sorted Matrix |
Iteration |
Iteration |
| 1356 |
Sort Integers by The Number of 1 Bits |
Bitwise |
Bits |
| 1359 |
Count All Valid Pickup and Delivery Options |
Maths |
Integer Overflow |
| 1361 |
Validate Binary Tree Nodes |
Union-Find (Modified) |
Binary Trees |
| 1376 |
Time Needed to Inform All Employees |
Depth First Search |
Tree Traversal |
| 1382 |
Balance a Binary Search Tree |
Inorder |
Binary Search Trees |
| 1396 |
Design Underground System |
Unordered Maps |
Data Structures |
| 1402 |
Reducing Dishes |
Greedy |
Problem-Solving |
| 1406 |
Stone Game III |
Memoisation |
Problem-Solving |
| 1420 |
Build Array Where You Can Find The Maximum Exactly K Comparisons |
Dynamic Programming |
Problem-Solving |
| 1425 |
Constrained Subsequence Sum |
Dynamic Programming |
Priority Queue |
| 1438 |
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit |
Sliding Window |
Min/Max in Window |
| 1456 |
Maximum Number of Vowels in a Substring of Given Length |
Sliding Window |
Sliding Window |
| 1458 |
Max Dot Product of Two Subsequences |
Dynamic Programming |
Problem-Solving |
| 1466 |
Reorder Routes to Make All Paths Lead to the City Zero |
Breadth-First Search |
Tree Traversal |
| 1472 |
Design Browser History |
Vector |
Data Structures |
| 1482 |
Minimum Number of Days to Make m Bouquets |
Binary Search |
Optimisation |
| 1489 |
Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree |
Kruskal's Algorithm |
Graphs |
| 1491 |
Average Salary Excluding the Minimum and Maximum Salary |
Iteration |
Data Types |
| 1498 |
Number of Subsequences That Satisfy the Given Sum Condition |
Permutation, Modular Exp |
Permutation, Integer Overflow |
| 1502 |
Can Make Arithmetic Progression From Sequence |
Iteration |
Iteration |
| 1509 |
Minimum Difference Between Largest and Smallest Value in Three Moves |
Sorting |
Iteration |
| 1512 |
Number of Good Pairs |
Count |
Arrays |
| 1513 |
Number of Substrings With Only 1s |
Combinatorics |
Combinatorics |
| 1514 |
Path with Maximum Probability |
Dijkstra's Algorithm |
Graph Traversal |
| 1518 |
Water Bottles |
Iteration |
Iteration |
| 1526 |
Minimum Number of Increments on Subarrays to Form a Target Array |
Numpy |
Problem Solving |
| 1534 |
Count Good Triplets |
Frequency |
Code Optimisation |
| 1539 |
Kth Missing Positive Number |
Iteration |
Iteration |
| 1547 |
Minimum Cost to Cut a Stick |
Dynamic Programming |
Problem Solving |
| 1550 |
Three Consecutive Odds |
Iteration |
Iteration |
| 1552 |
Magnetic Force Between Two Balls |
Binary Search |
Problem Solving |
| 1557 |
Minimum Number of Vertices to Reach All Nodes |
Topological Sort |
Directed Graphs |
| 1569 |
Number of Ways to Reorder Array to Get Same BST |
Recursion |
Permutations |
| 1572 |
Matrix Diagonal Sum |
Indexing |
Arrays |
| 1575 |
Count All Possible Routes |
Memoisation |
Recursion |
| 1578 |
Minimum Time to Make Rope Colorful |
Pointers |
Pointers |
| 1579 |
Remove Max Number of Edges to Keep Graph Fully Traversable |
Union-Find |
Disjoint Sets |
| 1603 |
Design Parking System |
Vector |
Classes |
| 1611 |
Minimum One Bit Operations to Make Integers Zero |
Bitstring |
Patterns |
| 1615 |
Maximal Network Rank |
In-Degree |
Graphs |
| 1647 |
Minimum Deletions to Make Character Frequencies Unique |
Iteration |
Strings |
| 1697 |
Checking Existence of Edge Length Limited Paths |
Union-Find |
Disjoint Sets |
| 1721 |
Swapping Nodes in a Linked List |
Value Swap |
Linked Lists |
| 1732 |
Find the Highest Altitude |
Iteration |
Arrays |
| 1791 |
Find Center of Star Graph |
Direct Answer |
- |
| 1793 |
Maximum Score of a Good Subarray |
Greedy |
Problem Solving |
| 1799 |
Maximize Score After N Operations |
Dynamic Programming |
Substructure, Data Types |
| 1802 |
Maximum Value at a Given Index in a Bounded Array |
Binary Search |
Problem Solving |
| 1822 |
Sign of the Product of an Array |
Iteration |
Minimal Resource |
| 1857 |
Largest Color Value in a Directed Graph |
Topological Sort |
Directed Graphs |
| 1922 |
Count Good Numbers |
Permutations |
Permutations |
| 1964 |
Find the Longest Valid Obstacle Course at Each Position |
Dynamic Programming |
Permutations |
| 1970 |
Last Day Where You Can Still Cross |
Union-Find |
Disjoint Sets |
| 2009 |
Minimum Number of Operations to Make Array Continuous |
Sliding Window |
Problem Solving |
| 2037 |
Minimum Number of Moves to Seat Everyone |
Direct Solution |
Problem Solving |
| 2050 |
Parallel Courses III |
Topological Sort |
Directed Graphs |
| 2058 |
Find the Minimum and Maximum Number of Nodes Between Critical Points |
Crawl |
Linked Lists |
| 2090 |
K Radius Subarray Averages |
Sliding Window |
Iteration |
| 2101 |
Detonate the Maximum Bombs |
Sweepline DFS |
Geometry |
| 2125 |
Number of Laser Beams in a Bank |
Iteration |
Problem Formulation |
| 2130 |
Maximum Twin Sum of a Linked List |
Reverse Linked List |
Linked Lists |
| 2140 |
Solving Questions With Brainpower |
Dynamic Programming |
Optimal Substructure |
| 2145 |
Count the Hidden Sequences |
Intervals |
Sets |
| 2169 |
Count Operations to Obtain Zero |
Remainders |
Real Numbers |
| 2176 |
Count Equal and Divisible Pairs in an Array |
Dictionary |
Iteration |
| 2181 |
Merge Nodes in Between Zeros |
Pointers |
Linked Lists |
| 2187 |
Minimum Time to Complete Tips |
Binary Search |
Binary Search, Integer Overflow |
| 2215 |
Find the Difference of Two Arrays |
Hashmap |
Arrays |
| 2251 |
Number of Flowers in Full Bloom |
Binary Search |
Ranges |
| 2257 |
Count Unguarded Cells in the Grid |
Iteration |
Simulation |
| 2285 |
Maximum Total Importance of Roads |
Greedy |
Graphs |
| 2300 |
Successful Pairs of Spells and Potions |
Array Sorting |
Sorted Arrays |
| 2316 |
Count Unreachable Pairs of Nodes in an Undirected Graph |
Union-Find |
Disjoint Sets |
| 2328 |
Number of Increasing Paths in a Grid |
Dynamic Programming |
Problem Solving |
| 2336 |
Smallest Number in Infinite Set |
Sets |
Ordered Sets |
| 2348 |
Number of Zero-Filled Subarrays |
Iteration |
Permutations |
| 2352 |
Equal Row and Column Pairs |
Hashmap |
Value Lookup |
| 2356 |
Increment Submatrices by One |
2D Difference Array |
Matrix |
| 2360 |
Longest Cycle in a Graph |
Topological Sort |
Graph Cycles |
| 2366 |
Minimum Replacements to Sort the Array |
Iteration |
Problem Solving |
| 2369 |
Check if There is a Valid Partition For The Array |
Dynamic Programming |
Pattern Finding |
| 2390 |
Removing Stars From a String |
Stack |
Iteration |
| 2405 |
Optimal Partition of String |
Greedy |
Problem Solving |
| 2433 |
Find The Original Array of Prefix XOR |
Maths |
Bitwise Operations |
| 2439 |
Minimize Maximum of Array |
Greedy |
Problem Solving |
| 2444 |
Count Subarrays w/ Fixed Bounds |
Iteration |
Iteration |
| 2448 |
Minimum Cost to Make Array Equal |
Convex Optimisation |
Optimisation |
| 2462 |
Total Cost to Hire K Workers |
Priority Queue |
Queues |
| 2466 |
Count Ways To Build Good Strings |
Dynamic Programming |
Optimal Substructure |
| 2483 |
Minimum Penalty for a Shop |
Iteration |
Iteration |
| 2492 |
Minimum Score of a Path Between Two Cities |
Union-Find |
Disjoint Sets |
| 2528 |
Maximize the Minimum Powered City |
Binary Search + Greedy |
Problem Solving |
| 2537 |
Count the Number of Good Subarrays |
Sliding Window |
Problem Solving |
| 2542 |
Maximum Subsequence Score |
Problem Reduction |
Problem Solving |
| 2563 |
Count the Number of Fair Pairs |
Binary Bisection |
Binary Search |
| 2582 |
Pass the Pillow |
Maths |
Problem Solving |
| 2616 |
Minimize the Maximum Difference of Pairs |
Binary Search, Greedy |
Problem Solving |
| 2654 |
Minimum Number of Operations to Make All Array Elements Equal to 1 |
Iteration |
Puzzles |
| 2707 |
Extra Characters in a String |
Memoisation |
Substrings |
| 2742 |
Painting the Walls |
Dynamic Programming |
Problem Solving |
| 3217 |
Delete Nodes From Linked List Present in Array |
Linked List |
Linked List |
| 3228 |
Maximum Number of Operations to Move Ones to the End |
Iteration |
Puzzles |
| 3234 |
Count the Number of Substrings With Dominant Ones |
Short-Circuit |
Puzzles |
| 3272 |
Find the Count of Good Integers |
Permutations |
Permutations |
| 3318 |
Find X-Sum of All K-Long Subarrays I |
Rolling Window, Priority Queues |
Lists |
| 3354 |
Make Array Elements Equal to Zero |
Rolling Sum |
Problem Solving |
| 3370 |
Smallest Number With All Set Bits |
Logarithm |
Maths |
| 3542 |
Minimum Operations to Convert All Elements to Zero |
Monotonic Stack |
Real Numbers |
| 3607 |
Power Grid Maintenance |
Union-Find & Minheap |
Disjoint Sets |