DSA Sheets
Two Pointer
Two Pointer
LeetCode 11 | Container With Most Water LeetCode 15 | 3Sum LeetCode 18 | 4Sum LeetCode 31 | Next Permutation LeetCode 75 | Sort Colors LeetCode 167 | Two Sum II - Input Array Is Sorted LeetCode 189 | Rotate Array LeetCode 344 | Reverse String LeetCode 556 | Next Greater Element III LeetCode 633 | Sum of Square Numbers LeetCode 881 | Boats to Save People LeetCode 948 | Bag of Tokens LeetCode 969 | Pancake Sorting LeetCode 1498 | Number of Subsequences That Satisfy the Given Sum Condition LeetCode 1750 | Minimum Length of String After Deleting Similar Ends LeetCode 1813 | Sentence Similarity III LeetCode 1850 | Minimum Adjacent Swaps to Reach the Kth Smallest Number LeetCode 1877 | Minimize Maximum Pair Sum in Array
Fast Slow
Tree
Tree
LeetCode 98 | Validate Binary Search Tree LeetCode 100 | Same Tree LeetCode 104 | Maximum Depth of Binary Tree LeetCode 105 | Construct Binary Tree from Preorder and Inorder Traversal LeetCode 110 | Balanced Binary Tree LeetCode 111 | Minimum Depth of Binary Tree LeetCode 113 | Path Sum II LeetCode 114 | Flatten Binary Tree to Linked List LeetCode 199 | Binary Tree Right Side View LeetCode 226 | Invert Binary Tree LeetCode 230 | Kth Smallest Element in a BST LeetCode 235 | Lowest Common Ancestor of a Binary Search Tree LeetCode 236 | Lowest Common Ancestor of a Binary Tree LeetCode 437 | Path Sum III LeetCode 530 | Minimum Absolute Difference in BST LeetCode 543 | Diameter of Binary Tree LeetCode 617 | Merge Two Binary Trees LeetCode 662 | Maximum Width of Binary Tree LeetCode 669 | Trim a Binary Search Tree LeetCode 863 | All Nodes Distance K in Binary Tree LeetCode 865 | Smallest Subtree with all the Deepest Nodes LeetCode 889 | Construct Binary Tree from Preorder and Postorder Traversal LeetCode 938 | Range Sum of BST LeetCode 958 | Check Completeness of a Binary Tree LeetCode 1008 | Construct Binary Search Tree from Preorder Traversal LeetCode 1123 | Lowest Common Ancestor of Deepest Leaves LeetCode 1305 | All Elements in Two Binary Search Trees LeetCode 1361 | Validate Binary Tree Nodes LeetCode 1379 | Find a Corresponding Node of a Binary Tree in a Clone of That Tree LeetCode 1457 | Pseudo-Palindromic Paths in a Binary Tree LeetCode 1530 | Number of Good Leaf Nodes Pairs
Tree
LeetCode 95 | Unique Binary Search Trees II LeetCode 98 | Validate Binary Search Tree LeetCode 99 | Recover Binary Search Tree LeetCode 100 | Same Tree LeetCode 102 | Binary Tree Level Order Traversal LeetCode 103 | Binary Tree Zigzag Level Order Traversal LeetCode 104 | Maximum Depth of Binary Tree LeetCode 107 | Binary Tree Level Order Traversal II LeetCode 109 | Convert Sorted List to Binary Search Tree LeetCode 111 | Minimum Depth of Binary Tree LeetCode 199 | Binary Tree Right Side View LeetCode 230 | Kth Smallest Element in a BST LeetCode 235 | Lowest Common Ancestor of a Binary Search Tree LeetCode 236 | Lowest Common Ancestor of a Binary Tree LeetCode 429 | N-ary Tree Level Order Traversal LeetCode 437 | Path Sum III LeetCode 449 | Serialize and Deserialize BST LeetCode 515 | Find Largest Value in Each Tree Row LeetCode 530 | Minimum Absolute Difference in BST LeetCode 538 | Convert BST to Greater Tree LeetCode 623 | Add One Row to Tree LeetCode 662 | Maximum Width of Binary Tree LeetCode 669 | Trim a Binary Search Tree LeetCode 703 | Kth Largest Element in a Stream LeetCode 863 | All Nodes Distance K in Binary Tree LeetCode 865 | Smallest Subtree with all the Deepest Nodes LeetCode 872 | Leaf-Similar Trees LeetCode 889 | Construct Binary Tree from Preorder and Postorder Traversal LeetCode 894 | All Possible Full Binary Trees LeetCode 938 | Range Sum of BST LeetCode 951 | Flip Equivalent Binary Trees LeetCode 958 | Check Completeness of a Binary Tree LeetCode 971 | Flip Binary Tree To Match Preorder Traversal LeetCode 988 | Smallest String Starting From Leaf LeetCode 1008 | Construct Binary Search Tree from Preorder Traversal LeetCode 1026 | Maximum Difference Between Node and Ancestor LeetCode 1038 | Binary Search Tree to Greater Sum Tree LeetCode 1080 | Insufficient Nodes in Root to Leaf Paths LeetCode 1104 | Path In Zigzag Labelled Binary Tree LeetCode 1110 | Delete Nodes And Return Forest LeetCode 1123 | Lowest Common Ancestor of Deepest Leaves LeetCode 1161 | Maximum Level Sum of a Binary Tree LeetCode 1302 | Deepest Leaves Sum LeetCode 1305 | All Elements in Two Binary Search Trees LeetCode 1315 | Sum of Nodes with Even-Valued Grandparent LeetCode 1325 | Delete Leaves With a Given Value LeetCode 1361 | Validate Binary Tree Nodes LeetCode 1448 | Count Good Nodes in Binary Tree LeetCode 1457 | Pseudo-Palindromic Paths in a Binary Tree LeetCode 1519 | Number of Nodes in the Sub-Tree With the Same Label LeetCode 1530 | Number of Good Leaf Nodes Pairs LeetCode 1609 | Even Odd Tree
Sliding Window
Sliding Window
LeetCode 2 | Add Two Numbers LeetCode 209 | Minimum Size Subarray Sum LeetCode 406 | Queue Reconstruction by Height LeetCode 424 | Longest Repeating Character Replacement LeetCode 904 | Fruit Into Baskets LeetCode 930 | Binary Subarrays With Sum LeetCode 1004 | Max Consecutive Ones III LeetCode 1208 | Get Equal Substrings Within Budget LeetCode 1234 | Replace the Substring for Balanced String LeetCode 1248 | Count Number of Nice Subarrays LeetCode 1358 | Number of Substrings Containing All Three Characters LeetCode 1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
String
String
LeetCode 20 | Valid Parentheses LeetCode 22 | Generate Parentheses LeetCode 125 | Valid Palindrome LeetCode 131 | Palindrome Partitioning LeetCode 205 | Isomorphic Strings LeetCode 242 | Valid Anagram LeetCode 318 | Maximum Product of Word Lengths LeetCode 402 | Remove K Digits LeetCode 409 | Longest Palindrome LeetCode 451 | Sort Characters By Frequency LeetCode 516 | Longest Palindromic Subsequence LeetCode 647 | Palindromic Substrings LeetCode 791 | Custom Sort String LeetCode 792 | Number of Matching Subsequences LeetCode 856 | Score of Parentheses LeetCode 859 | Buddy Strings LeetCode 1048 | Longest String Chain LeetCode 1143 | Longest Common Subsequence LeetCode 1177 | Can Make Palindrome from Substring LeetCode 1239 | Maximum Length of a Concatenated String with Unique Characters LeetCode 1249 | Minimum Remove to Make Valid Parentheses LeetCode 1297 | Maximum Number of Occurrences of a Substring LeetCode 1328 | Break a Palindrome LeetCode 1400 | Construct K Palindrome Strings LeetCode 1405 | Longest Happy String LeetCode 1433 | Check If a String Can Break Another String LeetCode 1616 | Split Two Strings to Make Palindrome LeetCode 1624 | Largest Substring Between Two Equal Characters LeetCode 1657 | Determine if Two Strings Are Close LeetCode 1662 | Check If Two String Arrays are Equivalent LeetCode 1790 | Check if One String Swap Can Make Strings Equal LeetCode 1880 | Check if Word Equals Summation of Two Words LeetCode 1903 | Largest Odd Number in String LeetCode 1915 | Number of Wonderful Substrings
Linked List
Linked List
LeetCode 2 | Add Two Numbers LeetCode 19 | Remove Nth Node From End of List LeetCode 21 | Merge Two Sorted Lists LeetCode 24 | Swap Nodes in Pairs LeetCode 138 | Copy List with Random Pointer LeetCode 141 | Linked List Cycle LeetCode 146 | LRU Cache LeetCode 206 | Reverse Linked List LeetCode 237 | Delete Node in a Linked List LeetCode 328 | Odd Even Linked List LeetCode 707 | Design Linked List LeetCode 725 | Split Linked List in Parts LeetCode 876 | Middle of the Linked List LeetCode 1171 | Remove Zero Sum Consecutive Nodes from Linked List LeetCode 1721 | Swapping Nodes in a Linked List LeetCode 1823 | Find the Winner of the Circular Game
Interval
Interval
Heap
Heap
LeetCode 215 | Kth Largest Element in an Array LeetCode 347 | Top K Frequent Elements LeetCode 373 | Find K Pairs with Smallest Sums LeetCode 378 | Kth Smallest Element in a Sorted Matrix LeetCode 451 | Sort Characters By Frequency LeetCode 621 | Task Scheduler LeetCode 692 | Top K Frequent Words LeetCode 703 | Kth Largest Element in a Stream LeetCode 767 | Reorganize String LeetCode 973 | K Closest Points to Origin
Top K Pattern
Merge Pattern
Min Pattern
Graph
Graph
LeetCode 200 | Number of Islands LeetCode 207 | Course Schedule LeetCode 210 | Course Schedule II LeetCode 399 | Evaluate Division LeetCode 547 | Number of Provinces LeetCode 721 | Accounts Merge LeetCode 733 | Flood Fill LeetCode 743 | Network Delay Time LeetCode 787 | Cheapest Flights Within K Stops LeetCode 947 | Most Stones Removed with Same Row or Column LeetCode 1311 | Get Watched Videos by Your Friends LeetCode 1319 | Number of Operations to Make Network Connected LeetCode 1334 | Find the City With the Smallest Number of Neighbors at a Threshold Distance LeetCode 1514 | Path with Maximum Probability LeetCode 1584 | Min Cost to Connect All Points LeetCode 1631 | Path With Minimum Effort
Graph
LeetCode 743 | Network Delay Time LeetCode 787 | Cheapest Flights Within K Stops LeetCode 1334 | Find the City With the Smallest Number of Neighbors at a Threshold Distance LeetCode 1514 | Path with Maximum Probability LeetCode 1631 | Path With Minimum Effort LeetCode 1786 | Number of Restricted Paths From First to Last Node
DSU
LeetCode 128 | Longest Consecutive Sequence LeetCode 547 | Number of Provinces LeetCode 721 | Accounts Merge LeetCode 959 | Regions Cut By Slashes LeetCode 990 | Satisfiability of Equality Equations LeetCode 1061 | Lexicographically Smallest Equivalent String LeetCode 1202 | Smallest String With Swaps LeetCode 1319 | Number of Operations to Make Network Connected
Fenwick Tree
Fenwick Tree
Dynamic Programming
Min-Max
Distinct Ways
LeetCode 62 | Unique Paths LeetCode 63 | Unique Paths II LeetCode 70 | Climbing Stairs LeetCode 377 | Combination Sum IV LeetCode 416 | Partition Equal Subset Sum LeetCode 494 | Target Sum LeetCode 576 | Out of Boundary Paths LeetCode 673 | Number of Longest Increasing Subsequence LeetCode 688 | Knight Probability in Chessboard LeetCode 790 | Domino and Tromino Tiling LeetCode 808 | Soup Servings LeetCode 935 | Knight Dialer LeetCode 1155 | Number of Dice Rolls With Target Sum
Merging Intervals
On Strings
Decision Making
Classical
LeetCode 5 | Longest Palindromic Substring LeetCode 53 | Maximum Subarray LeetCode 72 | Edit Distance LeetCode 97 | Interleaving String LeetCode 152 | Maximum Product Subarray LeetCode 300 | Longest Increasing Subsequence LeetCode 368 | Largest Divisible Subset LeetCode 516 | Longest Palindromic Subsequence LeetCode 673 | Number of Longest Increasing Subsequence LeetCode 718 | Maximum Length of Repeated Subarray LeetCode 764 | Largest Plus Sign LeetCode 873 | Length of Longest Fibonacci Subsequence LeetCode 898 | Bitwise ORs of Subarrays LeetCode 978 | Longest Turbulent Subarray LeetCode 1143 | Longest Common Subsequence LeetCode 1186 | Maximum Subarray Sum with One Deletion
Knapsack
Decision Making
Distinct Ways
LeetCode 62 | Unique Paths LeetCode 63 | Unique Paths II LeetCode 70 | Climbing Stairs LeetCode 377 | Combination Sum IV LeetCode 416 | Partition Equal Subset Sum LeetCode 494 | Target Sum LeetCode 576 | Out of Boundary Paths LeetCode 673 | Number of Longest Increasing Subsequence LeetCode 688 | Knight Probability in Chessboard LeetCode 790 | Domino and Tromino Tiling LeetCode 808 | Soup Servings LeetCode 935 | Knight Dialer LeetCode 1155 | Number of Dice Rolls With Target Sum
Max Min
Grid
Math realted
Dp on Strings
Graph/ Tree
Bit Manipulation Dp
Interval
LeetCode 375 | Guess Number Higher or Lower II LeetCode 486 | Predict the Winner LeetCode 647 | Palindromic Substrings LeetCode 877 | Stone Game LeetCode 1039 | Minimum Score Triangulation of Polygon LeetCode 1049 | Last Stone Weight II LeetCode 1130 | Minimum Cost Tree From Leaf Values LeetCode 1690 | Stone Game VII
Merging Interval
Multi Dimesion
LeetCode 377 | Combination Sum IV LeetCode 576 | Out of Boundary Paths LeetCode 688 | Knight Probability in Chessboard LeetCode 799 | Champagne Tower LeetCode 813 | Largest Sum of Averages LeetCode 931 | Minimum Falling Path Sum LeetCode 1024 | Video Stitching LeetCode 1027 | Longest Arithmetic Subsequence LeetCode 1140 | Stone Game II LeetCode 1155 | Number of Dice Rolls With Target Sum LeetCode 1621 | Number of Sets of K Non-Overlapping Line Segments
Recursion/Backtracking
Recursion/Backtracking
LeetCode 17 | Letter Combinations of a Phone Number LeetCode 22 | Generate Parentheses LeetCode 39 | Combination Sum LeetCode 40 | Combination Sum II LeetCode 46 | Permutations LeetCode 47 | Permutations II LeetCode 77 | Combinations LeetCode 78 | Subsets LeetCode 79 | Word Search LeetCode 90 | Subsets II LeetCode 131 | Palindrome Partitioning
Binary Search
Binary Search
LeetCode 29 | Divide Two Integers LeetCode 33 | Search in Rotated Sorted Array LeetCode 34 | Find First and Last Position of Element in Sorted Array LeetCode 50 | Pow(x, n) LeetCode 74 | Search a 2D Matrix LeetCode 162 | Find Peak Element LeetCode 475 | Heaters LeetCode 704 | Binary Search LeetCode 852 | Peak Index in a Mountain Array LeetCode 981 | Time Based Key-Value Store LeetCode 1011 | Capacity To Ship Packages Within D Days LeetCode 1283 | Find the Smallest Divisor Given a Threshold LeetCode 1351 | Count Negative Numbers in a Sorted Matrix LeetCode 1631 | Path With Minimum Effort LeetCode 1658 | Minimum Operations to Reduce X to Zero LeetCode 1760 | Minimum Limit of Balls in a Bag LeetCode 1818 | Minimum Absolute Sum Difference LeetCode 1838 | Frequency of the Most Frequent Element LeetCode 2064 | Minimized Maximum of Products Distributed to Any Store LeetCode 2070 | Most Beautiful Item for Each Query
Credit: Leetcode