LeetCode Problems by Official Solution Category
Suppose you're trying to learn how to use counting sort in the context of solving a programming challenge. A variety of strategies are possible, but solving a LeetCode problem is likely a good strategy for at least two reasons:
- The problem is supposed to be one seen before in interview settings (often making it more practical than theoretical).
- Accepted solutions must pass several test cases, sometimes hundreds or even over a thousand test cases.
But how can you effectively find problems on LeetCode where counting sort should be used? You could try consulting the sorting tag, where currently (Jan 15, 2025) there are well over 400 problems that bear the Sorting
tag, but nothing is said about the specific sorting technique used (e.g., counting sort, bubble sort, cycle sort, merge sort, radix sort, etc.). On the other hand, there are some solution techniques (e.g., DFS and BFS on binary trees or general graphs) so general as to almost be useless to specify.
The lists of problems below are intended to make it easier to practice various problem-solving techniques. How? Each listed problem belongs to a specific solution category, where that solution category was used as an official solution to the linked problem on LeetCode's platform. For example, in the Cycle Sort category, problem LC 442. Find All Duplicates in an Array is listed — this means an official cycle sort solution is posted on LeetCode's platform for this problem (approach 4 as of writing).
How is this helpful? The goal is to highlight problem-solving techniques or algorithms that may not often appear in some official solutions (e.g., Floyd-Warshall, Hierholzer, Manacher, etc.) while also providing a number of practice problems for more established techniques (e.g., sliding window, two pointer, etc.). The lists below are by no means complete. LeetCode adds problem solutions and new approaches every single day. The point is that you can now view a large number of problems based on official solutions provided for those problems, hopefully allowing you to narrow what problems you practice based on what you are trying to learn.
The full category list is provided below for quick reference but also appears in the side menu:
- A*
- Backtracking
- Bellman-Ford
- BFS - Multisource
- Binary search
- Binary search (recursive)
- Binary tree (indexed, Fenwick Tree)
- Binary tree (inorder, iterative)
- Binary tree (inorder, recursive)
- Binary tree (postorder, iterative)
- Binary tree (postorder, recursive)
- Binary tree (preorder, iterative)
- Binary tree (preorder, recursive)
- Bit manipulation
- Bitmasking
- Bitwise trie
- Boolean array
- Boyer-Moore
- Brian Kernighan
- BST
- Bubble sort
- Bucket sort
- Caching
- Canonical hash
- Cantor diagonal
- Cascading
- Catalan numbers
- Check all substrings
- Circular queue
- Connected components
- Convex hull
- Counting sort
- Cycle sort
- Day-Stout-Warren
- Deque
- Deterministic finite automaton
- Difference array
- Dijkstra
- Divide and conquer
- Doubly-linked list
- Dynamic programming
- Dynamic programming (2D)
- Dynamic programming (3D)
- Dynamic programming (iterative)
- Dynamic programming (space optimized)
- Dynamic programming (state machine)
- Eulerian path
- Eulerian tour
- Factorial number system
- Fisher-Yates
- Floyd-Warshall
- Follow the rules
- GCD
- Graham scan
- Gray code
- Greedy
- Hadlock
- Hashmap
- Hashmap (one pass)
- Hashmap (two pass)
- Heap (priority queue)
- Heapsort
- Hierholzer
- Horizontal scanning
- Index as hash key
- Insertion sort
- Integer overflow
- Interval stabbing
- Inverse Burrows-Wheeler transform
- Jarvis
- JavaScript
- Kadane
- Karnaugh map
- KMP (Knuth-Morris-Pratt)
- Line sweep
- Linear algebra
- Linear transformation
- Manacher
- Manhattan distance
- Math
- Matrix
- Matrix chain multiplication
- Matrix (Yale)
- Meet in the middle
- Merge sort
- Minimax
- Monotone chain
- Monotonic deque
- Monotonic stack
- Morris traversal
- MST (Kruskal)
- MST (Prim)
- Multiset
- Ordered map
- Ordered set
- Palindrome
- Pandas
- Pigeonhole principle
- Prefix product
- Prefix sum
- Prefix sum (hashing)
- Prefix sum (space optimized)
- Queue
- Quickselect
- Quicksort
- Rabin-Karp (binary search)
- Rabin-Karp (single hash)
- Rabin-Karp (double hash)
- Rabin-Karp (rolling hash)
- Radix sort
- Recursion
- Regex
- Rejection sampling
- Reservoir sampling
- Rolling hash
- Segment tree
- Sieve of Eratosthenes
- Simulation
- Sliding window
- Sliding window (optimized)
- Sorting
- Shortest path first algorithm (SPFA)
- Stack
- Suffix array
- Suffix product
- Suffix sum
- Tarjan
- Ternary search
- Three pointers
- Timsort
- Topological sort
- Topological sort (longest path)
- Tree hash
- Tree map
- Tree (n-ary)
- Trie
- Two pointer
- Union-find
- Vertical scanning
- Warnsdorff rule
- Wormhole teleportation
A*
See A* search algorithm.
- LC 675. Cut Off Trees for Golf Event
- LC 1091. Shortest Path in Binary Matrix
- LC 1293. Shortest Path in a Grid with Obstacles Elimination
- LC 1730. Shortest Path to Get Food
Backtracking
See backtracking.
- LC 17. Letter Combinations of a Phone Number
- LC 22. Generate Parentheses
- LC 37. Sudoku Solver
- LC 39. Combination Sum
- LC 40. Combination Sum II
- LC 44. Wildcard Matching
- LC 46. Permutations
- LC 47. Permutations II
- LC 51. N-Queens
- LC 52. N-Queens II
- LC 55. Jump Game
- LC 77. Combinations
- LC 78. Subsets
- LC 79. Word Search
- LC 89. Gray Code
- LC 90. Subsets II
- LC 93. Restore IP Addresses
- LC 126. Word Ladder II
- LC 131. Palindrome Partitioning
- LC 132. Palindrome Partitioning II
- LC 140. Word Break II
- LC 212. Word Search II
- LC 216. Combination Sum III
- LC 254. Factor Combinations
- LC 267. Palindrome Permutation II
- LC 281. Zigzag Iterator
- LC 291. Word Pattern II
- LC 301. Remove Invalid Parentheses
- LC 320. Generalized Abbreviation
- LC 351. Android Unlock Patterns
- LC 425. Word Squares
- LC 465. Optimal Account Balancing
- LC 489. Robot Room Cleaner
- LC 491. Non-decreasing Subsequences
- LC 526. Beautiful Arrangement
- LC 650. 2 Keys Keyboard
- LC 679. 24 Game
- LC 698. Partition to K Equal Sum Subsets
- LC 765. Couples Holding Hands
- LC 797. All Paths From Source to Target
- LC 949. Largest Time for Given Digits
- LC 980. Unique Paths III
- LC 996. Number of Squareful Arrays
- LC 1066. Campus Bikes II
- LC 1087. Brace Expansion
- LC 1088. Confusing Number II
- LC 1239. Maximum Length of a Concatenated String with Unique Characters
- LC 1255. Maximum Score Words Formed by Letters
- LC 1593. Split a String Into the Max Number of Unique Substrings
- LC 1601. Maximum Number of Achievable Transfer Requests
- LC 1631. Path With Minimum Effort
- LC 1641. Count Sorted Vowel Strings
- LC 1863. Sum of All Subset XOR Totals
- LC 2305. Fair Distribution of Cookies
- LC 2597. The Number of Beautiful Subsets
- LC 2664. The Knight’s Tour
Bellman-Ford
- LC 787. Cheapest Flights Within K Stops
- LC 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
- LC 1514. Path with Maximum Probability
BFS - Multisource
See multisource BFS.
- LC 317. Shortest Distance from All Buildings
- LC 542. 01 Matrix
- LC 1162. As Far from Land as Possible
- LC 2204. Distance to a Cycle in Undirected Graph
Binary search
See binary search (this includes binary search on normal arrays as well as solution spaces).
- LC 4. Median of Two Sorted Arrays
- LC 14. Longest Common Prefix
- LC 16. 3Sum Closest
- LC 33. Search in Rotated Sorted Array
- LC 34. Find First and Last Position of Element in Sorted Array
- LC 35. Search Insert Position
- LC 57. Insert Interval
- LC 69. Sqrt(x)
- LC 74. Search a 2D Matrix
- LC 81. Search in Rotated Sorted Array II
- LC 153. Find Minimum in Rotated Sorted Array
- LC 154. Find Minimum in Rotated Sorted Array II
- LC 162. Find Peak Element
- LC 222. Count Complete Tree Nodes
- LC 240. Search a 2D Matrix II
- LC 245. Shortest Word Distance III
- LC 259. 3Sum Smaller
- LC 270. Closest Binary Search Tree Value
- LC 272. Closest Binary Search Tree Value II
- LC 275. H-Index II
- LC 278. First Bad Version
- LC 287. Find the Duplicate Number
- LC 300. Longest Increasing Subsequence
- LC 302. Smallest Rectangle Enclosing Black Pixels
- LC 340. Longest Substring with At Most K Distinct Characters
- LC 367. Valid Perfect Square
- LC 374. Guess Number Higher or Lower
- LC 378. Kth Smallest Element in a Sorted Matrix
- LC 410. Split Array Largest Sum
- LC 424. Longest Repeating Character Replacement
- LC 441. Arranging Coins
- LC 456. 132 Pattern
- LC 497. Random Point in Non-overlapping Rectangles
- LC 528. Random Pick with Weight
- LC 540. Single Element in a Sorted Array
- LC 564. Find the Closest Palindrome
- LC 611. Valid Triangle Number
- LC 633. Sum of Square Numbers
- LC 644. Maximum Average Subarray II
- LC 649. Dota2 Senate
- LC 658. Find K Closest Elements
- LC 668. Kth Smallest Number in Multiplication Table
- LC 702. Search in a Sorted Array of Unknown Size
- LC 704. Binary Search
- LC 713. Subarray Product Less Than K
- LC 718. Maximum Length of Repeated Subarray
- LC 719. Find K-th Smallest Pair Distance
- LC 729. My Calendar I
- LC 744. Find Smallest Letter Greater Than Target
- LC 774. Minimize Max Distance to Gas Station
- LC 778. Swim in Rising Water
- LC 786. K-th Smallest Prime Fraction
- LC 793. Preimage Size of Factorial Zeroes Function
- LC 826. Most Profit Assigning Work
- LC 852. Peak Index in a Mountain Array
- LC 862. Shortest Subarray with Sum at Least K
- LC 875. Koko Eating Bananas
- LC 878. Nth Magical Number
- LC 887. Super Egg Drop
- LC 911. Online Election
- LC 973. K Closest Points to Origin
- LC 981. Time Based Key-Value Store
- LC 1011. Capacity To Ship Packages Within D Days
- LC 1055. Shortest Way to Form String
- LC 1060. Missing Element in Sorted Array
- LC 1062. Longest Repeating Substring
- LC 1064. Fixed Point
- LC 1095. Find in Mountain Array
- LC 1099. Two Sum Less Than K
- LC 1102. Path With Maximum Minimum Value
- LC 1146. Snapshot Array
- LC 1150. Check If a Number Is Majority Element in a Sorted Array
- LC 1182. Shortest Distance to Target Color
- LC 1198. Find Smallest Common Element in All Rows
- LC 1199. Minimum Time to Build Blocks
- LC 1228. Missing Number In Arithmetic Progression
- LC 1231. Divide Chocolate
- LC 1235. Maximum Profit in Job Scheduling
- LC 1268. Search Suggestions System
- LC 1283. Find the Smallest Divisor Given a Threshold
- LC 1287. Element Appearing More Than 25% In Sorted Array
- LC 1337. The K Weakest Rows in a Matrix
- LC 1346. Check If N and Its Double Exist
- LC 1351. Count Negative Numbers in a Sorted Matrix
- LC 1413. Minimum Value to Get Positive Step by Step Sum
- LC 1428. Leftmost Column with at Least a One
- LC 1482. Minimum Number of Days to Make m Bouquets
- LC 1498. Number of Subsequences That Satisfy the Given Sum Condition
- LC 1508. Range Sum of Sorted Subarray Sums
- LC 1533. Find the Index of the Large Integer
- LC 1539. Kth Missing Positive Number
- LC 1552. Magnetic Force Between Two Balls
- LC 1574. Shortest Subarray to be Removed to Make Array Sorted
- LC 1631. Path With Minimum Effort
- LC 1640. Check Array Formation Through Concatenation
- LC 1642. Furthest Building You Can Reach
- LC 1671. Minimum Number of Removals to Make Mountain Array
- LC 1751. Maximum Number of Events That Can Be Attended II
- LC 1793. Maximum Score of a Good Subarray
- LC 1802. Maximum Value at a Given Index in a Bounded Array
- LC 1838. Frequency of the Most Frequent Element
- LC 1855. Maximum Distance Between a Pair of Values
- LC 1870. Minimum Speed to Arrive on Time
- LC 1885. Count Pairs in Two Arrays
- LC 1891. Cutting Ribbons
- LC 1894. Find the Student that Will Replace the Chalk
- LC 1940. Longest Common Subsequence Between Sorted Arrays
- LC 1964. Find the Longest Valid Obstacle Course at Each Position
- LC 1970. Last Day Where You Can Still Cross
- LC 2009. Minimum Number of Operations to Make Array Continuous
- LC 2024. Maximize the Confusion of an Exam
- LC 2064. Minimized Maximum of Products Distributed to Any Store
- LC 2070. Most Beautiful Item for Each Query
- LC 2141. Maximum Running Time of N Computers
- LC 2187. Minimum Time to Complete Trips
- LC 2251. Number of Flowers in Full Bloom
- LC 2300. Successful Pairs of Spells and Potions
- LC 2448. Minimum Cost to Make Array Equal
- LC 2485. Find the Pivot Integer
- LC 2501. Longest Square Streak in an Array
- LC 2540. Minimum Common Value
- LC 2554. Maximum Number of Integers to Choose From a Range I
- LC 2563. Count the Number of Fair Pairs
- LC 2616. Minimize the Maximum Difference of Pairs
- LC 2779. Maximum Beauty of an Array After Applying Operation
- LC 2812. Find the Safest Path in a Grid
- LC 2838. Maximum Coins Heroes Can Collect
- LC 2955. Number of Same-End Substrings
- LC 3097. Shortest Subarray With OR at Least K II
- LC 3152. Special Array II
Binary search (recursive)
Binary tree (indexed, Fenwick Tree)
See Fenwick tree.
- LC 308. Range Sum Query 2D - Mutable
- LC 315. Count of Smaller Numbers After Self
- LC 493. Reverse Pairs
- LC 1395. Count Number of Teams
- LC 1626. Best Team With No Conflicts
- LC 1649. Create Sorted Array through Instructions
Binary tree (inorder, iterative)
- LC 94. Binary Tree Inorder Traversal
- LC 98. Validate Binary Search Tree
- LC 99. Recover Binary Search Tree
- LC 270. Closest Binary Search Tree Value
- LC 1022. Sum of Root To Leaf Binary Numbers
- LC 1305. All Elements in Two Binary Search Trees
- LC 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
- LC 1586. Binary Search Tree Iterator II
Binary tree (inorder, recursive)
- LC 94. Binary Tree Inorder Traversal
- LC 98. Validate Binary Search Tree
- LC 99. Recover Binary Search Tree
- LC 230. Kth Smallest Element in a BST
- LC 270. Closest Binary Search Tree Value
- LC 272. Closest Binary Search Tree Value II
- LC 530. Minimum Absolute Difference in BST
- LC 783. Minimum Distance Between BST Nodes
- LC 897. Increasing Order Search Tree
- LC 1022. Sum of Root To Leaf Binary Numbers
- LC 1305. All Elements in Two Binary Search Trees
- LC 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
- LC 1382. Balance a Binary Search Tree
- LC 1586. Binary Search Tree Iterator II
Binary tree (postorder, iterative)
Binary tree (postorder, recursive)
- LC 124. Binary Tree Maximum Path Sum
- LC 145. Binary Tree Postorder Traversal
- LC 333. Largest BST Subtree
- LC 449. Serialize and Deserialize BST
- LC 508. Most Frequent Subtree Sum
- LC 563. Binary Tree Tilt
- LC 1110. Delete Nodes And Return Forest
- LC 1120. Maximum Average Subtree
- LC 1325. Delete Leaves With a Given Value
- LC 1530. Number of Good Leaf Nodes Pairs
- LC 1973. Count Nodes Equal to Sum of Descendants
Binary tree (preorder, iterative)
- LC 129. Sum Root to Leaf Numbers
- LC 144. Binary Tree Preorder Traversal
- LC 145. Binary Tree Postorder Traversal
- LC 404. Sum of Left Leaves
- LC 1302. Deepest Leaves Sum
- LC 1457. Pseudo-Palindromic Paths in a Binary Tree
Binary tree (preorder, recursive)
- LC 129. Sum Root to Leaf Numbers
- LC 333. Largest BST Subtree
- LC 404. Sum of Left Leaves
- LC 508. Most Frequent Subtree Sum
- LC 545. Boundary of Binary Tree
- LC 1457. Pseudo-Palindromic Paths in a Binary Tree
Bit manipulation
- LC 29. Divide Two Integers
- LC 67. Add Binary
- LC 69. Sqrt(x)
- LC 136. Single Number
- LC 137. Single Number II
- LC 169. Majority Element
- LC 187. Repeated DNA Sequences
- LC 190. Reverse Bits
- LC 191. Number of 1 Bits
- LC 201. Bitwise AND of Numbers Range
- LC 231. Power of Two
- LC 268. Missing Number
- LC 287. Find the Duplicate Number
- LC 320. Generalized Abbreviation
- LC 338. Counting Bits
- LC 342. Power of Four
- LC 371. Sum of Two Integers
- LC 389. Find the Difference
- LC 393. UTF-8 Validation
- LC 421. Maximum XOR of Two Numbers in an Array
- LC 461. Hamming Distance
- LC 476. Number Complement
- LC 600. Non-negative Integers without Consecutive Ones
- LC 645. Set Mismatch
- LC 661. Image Smoother
- LC 760. Find Anagram Mappings
- LC 898. Bitwise ORs of Subarrays
- LC 957. Prison Cells After N Days
- LC 1009. Complement of Base 10 Integer
- LC 1022. Sum of Root To Leaf Binary Numbers
- LC 1239. Maximum Length of a Concatenated String with Unique Characters
- LC 1290. Convert Binary Number in a Linked List to Integer
- LC 1310. XOR Queries of a Subarray
- LC 1318. Minimum Flips to Make a OR b Equal to c
- LC 1342. Number of Steps to Reduce a Number to Zero
- LC 1356. Sort Integers by The Number of 1 Bits
- LC 1400. Construct K Palindrome Strings
- LC 1437. Check If All 1''s Are at Least Length K Places Away
- LC 1442. Count Triplets That Can Form Two Arrays of Equal XOR
- LC 1545. Find Kth Bit in Nth Binary String
- LC 1657. Determine if Two Strings Are Close
- LC 1680. Concatenation of Consecutive Binary Numbers
- LC 1684. Count the Number of Consistent Strings
- LC 1832. Check if the Sentence Is Pangram
- LC 1863. Sum of All Subset XOR Totals
- LC 1908. Game of Nim
- LC 2044. Count Number of Maximum Bitwise-OR Subsets
- LC 2220. Minimum Bit Flips to Convert Number
- LC 2275. Largest Combination With Bitwise AND Greater Than Zero
- LC 2425. Bitwise XOR of All Pairings
- LC 2429. Minimize XOR
- LC 2433. Find The Original Array of Prefix Xor
- LC 2441. Largest Positive Integer That Exists With Its Negative
- LC 2471. Minimum Number of Operations to Sort a Binary Tree by Level
- LC 2597. The Number of Beautiful Subsets
- LC 2683. Neighboring Bitwise XOR
- LC 2802. Find The K-th Lucky Number
- LC 2864. Maximum Odd Binary Number
- LC 2997. Minimum Number of Operations to Make Array XOR Equal to K
- LC 3133. Minimum Array End
Bitmasking
- LC 36. Valid Sudoku
- LC 90. Subsets II
- LC 137. Single Number II
- LC 187. Repeated DNA Sequences
- LC 190. Reverse Bits
- LC 260. Single Number III
- LC 318. Maximum Product of Word Lengths
- LC 476. Number Complement
- LC 477. Total Hamming Distance
- LC 491. Non-decreasing Subsequences
- LC 698. Partition to K Equal Sum Subsets
- LC 784. Letter Case Permutation
- LC 1009. Complement of Base 10 Integer
- LC 1066. Campus Bikes II
- LC 1125. Smallest Sufficient Team
- LC 1178. Number of Valid Words for Each Puzzle
- LC 1286. Iterator for Combination
- LC 1371. Find the Longest Substring Containing Vowels in Even Counts
- LC 1434. Number of Ways to Wear Different Hats to Each Other
- LC 1601. Maximum Number of Achievable Transfer Requests
- LC 1799. Maximize Score After N Operations
- LC 1829. Maximum XOR for Each Query
- LC 1915. Number of Wonderful Substrings
Bitwise trie
Boolean array
- LC 41. First Missing Positive
- LC 649. Dota2 Senate
- LC 1684. Count the Number of Consistent Strings
- LC 1695. Maximum Erasure Value
Boyer-Moore
Brian Kernighan
BST
- LC 219. Contains Duplicate II
- LC 220. Contains Duplicate III
- LC 493. Reverse Pairs
- LC 653. Two Sum IV - Input is a BST
- LC 705. Design HashSet
Bubble sort
- LC 280. Wiggle Sort
- LC 969. Pancake Sorting
- LC 1051. Height Checker
- LC 3011. Find if Array Can Be Sorted
Bucket sort
- LC 164. Maximum Gap
- LC 220. Contains Duplicate III
- LC 451. Sort Characters By Frequency
- LC 539. Minimum Time Difference
- LC 692. Top K Frequent Words
- LC 719. Find K-th Smallest Pair Distance
- LC 1046. Last Stone Weight
- LC 1057. Campus Bikes
- LC 1094. Car Pooling
- LC 1338. Reduce Array Size to The Half
Caching
- LC 303. Range Sum Query - Immutable
- LC 304. Range Sum Query 2D - Immutable
- LC 395. Longest Substring with At Least K Repeating Characters
Canonical hash
Cantor diagonal
Cascading
Catalan numbers
Check all substrings
Circular queue
Connected components
Convex hull
Counting sort
- LC 49. Group Anagrams
- LC 164. Maximum Gap
- LC 215. Kth Largest Element in an Array
- LC 274. H-Index
- LC 561. Array Partition
- LC 912. Sort an Array
- LC 1051. Height Checker
- LC 1099. Two Sum Less Than K
- LC 1122. Relative Sort Array
- LC 1196. How Many Apples Can You Put into the Basket
- LC 1200. Minimum Absolute Difference
- LC 1207. Unique Number of Occurrences
- LC 1329. Sort the Matrix Diagonally
- LC 1481. Least Number of Unique Integers after K Removals
- LC 1833. Maximum Ice Cream Bars
- LC 1874. Minimize Product Sum of Two Arrays
- LC 2007. Find Original Array From Doubled Array
- LC 2037. Minimum Number of Moves to Seat Everyone
- LC 2706. Buy Two Chocolates
- LC 2785. Sort Vowels in a String
- LC 3189. Minimum Moves to Get a Peaceful Board
Cycle sort
Day-Stout-Warren
Deque
- LC 151. Reverse Words in a String
- LC 272. Closest Binary Search Tree Value II
- LC 346. Moving Average from Data Stream
- LC 862. Shortest Subarray with Sum at Least K
- LC 919. Complete Binary Tree Inserter
- LC 995. Minimum Number of K Consecutive Bit Flips
- LC 1151. Minimum Swaps to Group All 1''s Together
- LC 1248. Count Number of Nice Subarrays
- LC 1425. Constrained Subsequence Sum
- LC 1561. Maximum Number of Coins You Can Get
- LC 1673. Find the Most Competitive Subsequence
- LC 1696. Jump Game VI
- LC 1813. Sentence Similarity III
- LC 3254. Find the Power of K-Size Subarrays I
Deterministic finite automaton
- LC 8. String to Integer (atoi)
- LC 10. Regular Expression Matching
- LC 44. Wildcard Matching
- LC 65. Valid Number
- LC 520. Detect Capital
- LC 890. Find and Replace Pattern
- LC 1018. Binary Prefix Divisible By 5
Difference array
Dijkstra
- LC 499. The Maze III
- LC 505. The Maze II
- LC 743. Network Delay Time
- LC 787. Cheapest Flights Within K Stops
- LC 818. Race Car
- LC 864. Shortest Path to Get All Keys
- LC 882. Reachable Nodes In Subdivided Graph
- LC 909. Snakes and Ladders
- LC 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
- LC 1514. Path with Maximum Probability
- LC 1631. Path With Minimum Effort
- LC 2045. Second Minimum Time to Reach Destination
- LC 2093. Minimum Cost to Reach City With Discounts
- LC 2290. Minimum Obstacle Removal to Reach Corner
- LC 2473. Minimum Cost to Buy Apples
- LC 2577. Minimum Time to Visit a Cell In a Grid
- LC 2642. Design Graph With Shortest Path Calculator
- LC 2699. Modify Graph Edge Weights
- LC 2976. Minimum Cost to Convert String I
Divide and conquer
- LC 14. Longest Common Prefix
- LC 22. Generate Parentheses
- LC 23. Merge k Sorted Lists
- LC 53. Maximum Subarray
- LC 84. Largest Rectangle in Histogram
- LC 169. Majority Element
- LC 218. The Skyline Problem
- LC 240. Search a 2D Matrix II
- LC 392. Is Subsequence
- LC 395. Longest Substring with At Least K Repeating Characters
- LC 468. Validate IP Address
- LC 856. Score of Parentheses
- LC 903. Valid Permutations for DI Sequence
- LC 932. Beautiful Array
- LC 1265. Print Immutable Linked List in Reverse
- LC 1274. Number of Ships in a Rectangle
- LC 1545. Find Kth Bit in Nth Binary String
Doubly-linked list
- LC 146. LRU Cache
- LC 432. All O`one Data Structure
- LC 707. Design Linked List
- LC 1472. Design Browser History
Dynamic programming
- LC 5. Longest Palindromic Substring
- LC 10. Regular Expression Matching
- LC 32. Longest Valid Parentheses
- LC 42. Trapping Rain Water
- LC 44. Wildcard Matching
- LC 53. Maximum Subarray
- LC 55. Jump Game
- LC 62. Unique Paths
- LC 63. Unique Paths II
- LC 64. Minimum Path Sum
- LC 70. Climbing Stairs
- LC 72. Edit Distance
- LC 85. Maximal Rectangle
- LC 87. Scramble String
- LC 91. Decode Ways
- LC 95. Unique Binary Search Trees II
- LC 96. Unique Binary Search Trees
- LC 97. Interleaving String
- LC 115. Distinct Subsequences
- LC 118. Pascal''s Triangle
- LC 119. Pascal''s Triangle II
- LC 120. Triangle
- LC 123. Best Time to Buy and Sell Stock III
- LC 131. Palindrome Partitioning
- LC 132. Palindrome Partitioning II
- LC 139. Word Break
- LC 140. Word Break II
- LC 152. Maximum Product Subarray
- LC 174. Dungeon Game
- LC 188. Best Time to Buy and Sell Stock IV
- LC 198. House Robber
- LC 213. House Robber II
- LC 221. Maximal Square
- LC 241. Different Ways to Add Parentheses
- LC 256. Paint House
- LC 264. Ugly Number II
- LC 265. Paint House II
- LC 276. Paint Fence
- LC 279. Perfect Squares
- LC 300. Longest Increasing Subsequence
- LC 309. Best Time to Buy and Sell Stock with Cooldown
- LC 312. Burst Balloons
- LC 322. Coin Change
- LC 329. Longest Increasing Path in a Matrix
- LC 337. House Robber III
- LC 338. Counting Bits
- LC 343. Integer Break
- LC 351. Android Unlock Patterns
- LC 354. Russian Doll Envelopes
- LC 361. Bomb Enemy
- LC 368. Largest Divisible Subset
- LC 375. Guess Number Higher or Lower II
- LC 376. Wiggle Subsequence
- LC 377. Combination Sum IV
- LC 392. Is Subsequence
- LC 403. Frog Jump
- LC 410. Split Array Largest Sum
- LC 413. Arithmetic Slices
- LC 416. Partition Equal Subset Sum
- LC 446. Arithmetic Slices II - Subsequence
- LC 453. Minimum Moves to Equal Array Elements
- LC 465. Optimal Account Balancing
- LC 472. Concatenated Words
- LC 473. Matchsticks to Square
- LC 474. Ones and Zeroes
- LC 486. Predict the Winner
- LC 494. Target Sum
- LC 514. Freedom Trail
- LC 516. Longest Palindromic Subsequence
- LC 518. Coin Change II
- LC 542. 01 Matrix
- LC 546. Remove Boxes
- LC 552. Student Attendance Record II
- LC 553. Optimal Division
- LC 568. Maximum Vacation Days
- LC 575. Distribute Candies
- LC 583. Delete Operation for Two Strings
- LC 629. K Inverse Pairs Array
- LC 634. Find the Derangement of An Array
- LC 638. Shopping Offers
- LC 639. Decode Ways II
- LC 646. Maximum Length of Pair Chain
- LC 647. Palindromic Substrings
- LC 650. 2 Keys Keyboard
- LC 651. 4 Keys Keyboard
- LC 656. Coin Path
- LC 659. Split Array into Consecutive Subsequences
- LC 664. Strange Printer
- LC 673. Number of Longest Increasing Subsequence
- LC 678. Valid Parenthesis String
- LC 688. Knight Probability in Chessboard
- LC 689. Maximum Sum of 3 Non-Overlapping Subarrays
- LC 691. Stickers to Spell Word
- LC 698. Partition to K Equal Sum Subsets
- LC 712. Minimum ASCII Delete Sum for Two Strings
- LC 714. Best Time to Buy and Sell Stock with Transaction Fee
- LC 718. Maximum Length of Repeated Subarray
- LC 719. Find K-th Smallest Pair Distance
- LC 727. Minimum Window Subsequence
- LC 740. Delete and Earn
- LC 741. Cherry Pickup
- LC 746. Min Cost Climbing Stairs
- LC 764. Largest Plus Sign
- LC 774. Minimize Max Distance to Gas Station
- LC 780. Reaching Points
- LC 788. Rotated Digits
- LC 790. Domino and Tromino Tiling
- LC 797. All Paths From Source to Target
- LC 801. Minimum Swaps To Make Sequences Increasing
- LC 808. Soup Servings
- LC 813. Largest Sum of Averages
- LC 818. Race Car
- LC 823. Binary Trees With Factors
- LC 826. Most Profit Assigning Work
- LC 837. New 21 Game
- LC 847. Shortest Path Visiting All Nodes
- LC 854. K-Similar Strings
- LC 871. Minimum Number of Refueling Stops
- LC 873. Length of Longest Fibonacci Subsequence
- LC 877. Stone Game
- LC 878. Nth Magical Number
- LC 887. Super Egg Drop
- LC 894. All Possible Full Binary Trees
- LC 902. Numbers At Most N Given Digit Set
- LC 903. Valid Permutations for DI Sequence
- LC 907. Sum of Subarray Minimums
- LC 920. Number of Music Playlists
- LC 926. Flip String to Monotone Increasing
- LC 931. Minimum Falling Path Sum
- LC 935. Knight Dialer
- LC 940. Distinct Subsequences II
- LC 943. Find the Shortest Superstring
- LC 956. Tallest Billboard
- LC 960. Delete Columns to Make Sorted III
- LC 964. Least Operators to Express Number
- LC 968. Binary Tree Cameras
- LC 983. Minimum Cost For Tickets
- LC 996. Number of Squareful Arrays
- LC 1014. Best Sightseeing Pair
- LC 1027. Longest Arithmetic Subsequence
- LC 1035. Uncrossed Lines
- LC 1043. Partition Array for Maximum Sum
- LC 1048. Longest String Chain
- LC 1062. Longest Repeating Substring
- LC 1066. Campus Bikes II
- LC 1105. Filling Bookcase Shelves
- LC 1125. Smallest Sufficient Team
- LC 1137. N-th Tribonacci Number
- LC 1143. Longest Common Subsequence
- LC 1155. Number of Dice Rolls With Target Sum
- LC 1162. As Far from Land as Possible
- LC 1180. Count Substrings with Only One Distinct Letter
- LC 1187. Make Array Strictly Increasing
- LC 1199. Minimum Time to Build Blocks
- LC 1218. Longest Arithmetic Subsequence of Given Difference
- LC 1219. Path with Maximum Gold
- LC 1220. Count Vowels Permutation
- LC 1230. Toss Strange Coins
- LC 1235. Maximum Profit in Job Scheduling
- LC 1259. Handshakes That Don''t Cross
- LC 1269. Number of Ways to Stay in the Same Place After Some Steps
- LC 1277. Count Square Submatrices with All Ones
- LC 1289. Minimum Falling Path Sum II
- LC 1312. Minimum Insertion Steps to Make a String Palindrome
- LC 1326. Minimum Number of Taps to Open to Water a Garden
- LC 1335. Minimum Difficulty of a Job Schedule
- LC 1359. Count All Valid Pickup and Delivery Options
- LC 1395. Count Number of Teams
- LC 1402. Reducing Dishes
- LC 1406. Stone Game III
- LC 1416. Restore The Array
- LC 1420. Build Array Where You Can Find The Maximum Exactly K Comparisons
- LC 1423. Maximum Points You Can Obtain from Cards
- LC 1434. Number of Ways to Wear Different Hats to Each Other
- LC 1444. Number of Ways of Cutting a Pizza
- LC 1458. Max Dot Product of Two Subsequences
- LC 1463. Cherry Pickup II
- LC 1473. Paint House III
- LC 1510. Stone Game IV
- LC 1531. String Compression II
- LC 1547. Minimum Cost to Cut a Stick
- LC 1548. The Most Similar Path in a Graph
- LC 1575. Count All Possible Routes
- LC 1626. Best Team With No Conflicts
- LC 1639. Number of Ways to Form a Target String Given a Dictionary
- LC 1641. Count Sorted Vowel Strings
- LC 1653. Minimum Deletions to Make String Balanced
- LC 1671. Minimum Number of Removals to Make Mountain Array
- LC 1690. Stone Game VII
- LC 1696. Jump Game VI
- LC 1706. Where Will the Ball Fall
- LC 1746. Maximum Subarray Sum After One Operation
- LC 1751. Maximum Number of Events That Can Be Attended II
- LC 1765. Map of Highest Peak
- LC 1770. Maximum Score from Performing Multiplication Operations
- LC 1799. Maximize Score After N Operations
- LC 1908. Game of Nim
- LC 1937. Maximum Number of Points with Cost
- LC 2044. Count Number of Maximum Bitwise-OR Subsets
- LC 2050. Parallel Courses III
- LC 2054. Two Best Non-Overlapping Events
- LC 2140. Solving Questions With Brainpower
- LC 2147. Number of Ways to Divide a Long Corridor
- LC 2218. Maximum Value of K Coins From Piles
- LC 2328. Number of Increasing Paths in a Grid
- LC 2355. Maximum Number of Books You Can Take
- LC 2361. Minimum Costs Using the Train Line
- LC 2369. Check if There is a Valid Partition For The Array
- LC 2370. Longest Ideal Subsequence
- LC 2393. Count Strictly Increasing Subarrays
- LC 2463. Minimum Total Distance Traveled
- LC 2466. Count Ways To Build Good Strings
- LC 2597. The Number of Beautiful Subsets
- LC 2684. Maximum Number of Moves in a Grid
- LC 2707. Extra Characters in a String
- LC 2742. Painting the Walls
- LC 3068. Find the Maximum Sum of Node Values
- LC 3243. Shortest Distance After Road Addition Queries I
Dynamic programming (2D)
- LC 64. Minimum Path Sum
- LC 97. Interleaving String
- LC 494. Target Sum
- LC 562. Longest Line of Consecutive One in Matrix
- LC 568. Maximum Vacation Days
- LC 730. Count Different Palindromic Subsequences
- LC 1216. Valid Palindrome III
- LC 1335. Minimum Difficulty of a Job Schedule
Dynamic programming (3D)
Dynamic programming (iterative)
- LC 55. Jump Game
- LC 72. Edit Distance
- LC 91. Decode Ways
- LC 95. Unique Binary Search Trees II
- LC 115. Distinct Subsequences
- LC 120. Triangle
- LC 132. Palindrome Partitioning II
- LC 139. Word Break
- LC 140. Word Break II
- LC 241. Different Ways to Add Parentheses
- LC 276. Paint Fence
- LC 312. Burst Balloons
- LC 322. Coin Change
- LC 343. Integer Break
- LC 377. Combination Sum IV
- LC 403. Frog Jump
- LC 410. Split Array Largest Sum
- LC 416. Partition Equal Subset Sum
- LC 486. Predict the Winner
- LC 509. Fibonacci Number
- LC 514. Freedom Trail
- LC 516. Longest Palindromic Subsequence
- LC 518. Coin Change II
- LC 552. Student Attendance Record II
- LC 646. Maximum Length of Pair Chain
- LC 650. 2 Keys Keyboard
- LC 664. Strange Printer
- LC 673. Number of Longest Increasing Subsequence
- LC 678. Valid Parenthesis String
- LC 688. Knight Probability in Chessboard
- LC 689. Maximum Sum of 3 Non-Overlapping Subarrays
- LC 698. Partition to K Equal Sum Subsets
- LC 712. Minimum ASCII Delete Sum for Two Strings
- LC 740. Delete and Earn
- LC 741. Cherry Pickup
- LC 746. Min Cost Climbing Stairs
- LC 790. Domino and Tromino Tiling
- LC 808. Soup Servings
- LC 878. Nth Magical Number
- LC 894. All Possible Full Binary Trees
- LC 920. Number of Music Playlists
- LC 931. Minimum Falling Path Sum
- LC 935. Knight Dialer
- LC 983. Minimum Cost For Tickets
- LC 1035. Uncrossed Lines
- LC 1043. Partition Array for Maximum Sum
- LC 1066. Campus Bikes II
- LC 1105. Filling Bookcase Shelves
- LC 1125. Smallest Sufficient Team
- LC 1137. N-th Tribonacci Number
- LC 1143. Longest Common Subsequence
- LC 1155. Number of Dice Rolls With Target Sum
- LC 1187. Make Array Strictly Increasing
- LC 1199. Minimum Time to Build Blocks
- LC 1216. Valid Palindrome III
- LC 1220. Count Vowels Permutation
- LC 1230. Toss Strange Coins
- LC 1235. Maximum Profit in Job Scheduling
- LC 1259. Handshakes That Don''t Cross
- LC 1269. Number of Ways to Stay in the Same Place After Some Steps
- LC 1277. Count Square Submatrices with All Ones
- LC 1289. Minimum Falling Path Sum II
- LC 1312. Minimum Insertion Steps to Make a String Palindrome
- LC 1335. Minimum Difficulty of a Job Schedule
- LC 1359. Count All Valid Pickup and Delivery Options
- LC 1395. Count Number of Teams
- LC 1402. Reducing Dishes
- LC 1406. Stone Game III
- LC 1416. Restore The Array
- LC 1420. Build Array Where You Can Find The Maximum Exactly K Comparisons
- LC 1434. Number of Ways to Wear Different Hats to Each Other
- LC 1458. Max Dot Product of Two Subsequences
- LC 1463. Cherry Pickup II
- LC 1473. Paint House III
- LC 1547. Minimum Cost to Cut a Stick
- LC 1575. Count All Possible Routes
- LC 1626. Best Team With No Conflicts
- LC 1639. Number of Ways to Form a Target String Given a Dictionary
- LC 1641. Count Sorted Vowel Strings
- LC 1690. Stone Game VII
- LC 1746. Maximum Subarray Sum After One Operation
- LC 1751. Maximum Number of Events That Can Be Attended II
- LC 1770. Maximum Score from Performing Multiplication Operations
- LC 1799. Maximize Score After N Operations
- LC 2140. Solving Questions With Brainpower
- LC 2147. Number of Ways to Divide a Long Corridor
- LC 2218. Maximum Value of K Coins From Piles
- LC 2361. Minimum Costs Using the Train Line
- LC 2369. Check if There is a Valid Partition For The Array
- LC 2370. Longest Ideal Subsequence
- LC 2463. Minimum Total Distance Traveled
- LC 2466. Count Ways To Build Good Strings
- LC 2597. The Number of Beautiful Subsets
- LC 2684. Maximum Number of Moves in a Grid
- LC 2707. Extra Characters in a String
- LC 2742. Painting the Walls
- LC 3068. Find the Maximum Sum of Node Values
- LC 3243. Shortest Distance After Road Addition Queries I
Dynamic programming (space optimized)
- LC 64. Minimum Path Sum
- LC 95. Unique Binary Search Trees II
- LC 115. Distinct Subsequences
- LC 119. Pascal''s Triangle II
- LC 132. Palindrome Partitioning II
- LC 198. House Robber
- LC 256. Paint House
- LC 265. Paint House II
- LC 276. Paint Fence
- LC 368. Largest Divisible Subset
- LC 376. Wiggle Subsequence
- LC 413. Arithmetic Slices
- LC 416. Partition Equal Subset Sum
- LC 486. Predict the Winner
- LC 494. Target Sum
- LC 514. Freedom Trail
- LC 516. Longest Palindromic Subsequence
- LC 518. Coin Change II
- LC 552. Student Attendance Record II
- LC 634. Find the Derangement of An Array
- LC 639. Decode Ways II
- LC 659. Split Array into Consecutive Subsequences
- LC 688. Knight Probability in Chessboard
- LC 712. Minimum ASCII Delete Sum for Two Strings
- LC 714. Best Time to Buy and Sell Stock with Transaction Fee
- LC 727. Minimum Window Subsequence
- LC 740. Delete and Earn
- LC 746. Min Cost Climbing Stairs
- LC 790. Domino and Tromino Tiling
- LC 931. Minimum Falling Path Sum
- LC 935. Knight Dialer
- LC 1014. Best Sightseeing Pair
- LC 1035. Uncrossed Lines
- LC 1143. Longest Common Subsequence
- LC 1162. As Far from Land as Possible
- LC 1199. Minimum Time to Build Blocks
- LC 1220. Count Vowels Permutation
- LC 1230. Toss Strange Coins
- LC 1269. Number of Ways to Stay in the Same Place After Some Steps
- LC 1277. Count Square Submatrices with All Ones
- LC 1289. Minimum Falling Path Sum II
- LC 1312. Minimum Insertion Steps to Make a String Palindrome
- LC 1395. Count Number of Teams
- LC 1402. Reducing Dishes
- LC 1406. Stone Game III
- LC 1416. Restore The Array
- LC 1420. Build Array Where You Can Find The Maximum Exactly K Comparisons
- LC 1423. Maximum Points You Can Obtain from Cards
- LC 1444. Number of Ways of Cutting a Pizza
- LC 1458. Max Dot Product of Two Subsequences
- LC 1473. Paint House III
- LC 1639. Number of Ways to Form a Target String Given a Dictionary
- LC 1653. Minimum Deletions to Make String Balanced
- LC 1690. Stone Game VII
- LC 1746. Maximum Subarray Sum After One Operation
- LC 1751. Maximum Number of Events That Can Be Attended II
- LC 1770. Maximum Score from Performing Multiplication Operations
- LC 1937. Maximum Number of Points with Cost
- LC 2147. Number of Ways to Divide a Long Corridor
- LC 2361. Minimum Costs Using the Train Line
- LC 2369. Check if There is a Valid Partition For The Array
- LC 2463. Minimum Total Distance Traveled
- LC 2597. The Number of Beautiful Subsets
- LC 2684. Maximum Number of Moves in a Grid
- LC 2742. Painting the Walls
Dynamic programming (state machine)
Eulerian path
Eulerian tour
Factorial number system
Fisher-Yates
Floyd-Warshall
- LC 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
- LC 2642. Design Graph With Shortest Path Calculator
- LC 2976. Minimum Cost to Convert String I
Follow the rules
GCD
Graham scan
Gray code
Greedy
- LC 12. Integer to Roman
- LC 45. Jump Game II
- LC 55. Jump Game
- LC 279. Perfect Squares
- LC 280. Wiggle Sort
- LC 316. Remove Duplicate Letters
- LC 358. Rearrange String k Distance Apart
- LC 376. Wiggle Subsequence
- LC 392. Is Subsequence
- LC 402. Remove K Digits
- LC 406. Queue Reconstruction by Height
- LC 409. Longest Palindrome
- LC 435. Non-overlapping Intervals
- LC 452. Minimum Number of Arrows to Burst Balloons
- LC 455. Assign Cookies
- LC 502. IPO
- LC 517. Super Washing Machines
- LC 527. Word Abbreviation
- LC 621. Task Scheduler
- LC 646. Maximum Length of Pair Chain
- LC 649. Dota2 Senate
- LC 659. Split Array into Consecutive Subsequences
- LC 665. Non-decreasing Array
- LC 670. Maximum Swap
- LC 717. 1-bit and 2-bit Characters
- LC 727. Minimum Window Subsequence
- LC 738. Monotone Increasing Digits
- LC 741. Cherry Pickup
- LC 757. Set Intersection Size At Least Two
- LC 763. Partition Labels
- LC 765. Couples Holding Hands
- LC 826. Most Profit Assigning Work
- LC 861. Score After Flipping Matrix
- LC 870. Advantage Shuffle
- LC 881. Boats to Save People
- LC 946. Validate Stack Sequences
- LC 948. Bag of Tokens
- LC 954. Array of Doubled Pairs
- LC 955. Delete Columns to Make Sorted II
- LC 968. Binary Tree Cameras
- LC 984. String Without AAA or BBB
- LC 1007. Minimum Domino Rotations For Equal Row
- LC 1029. Two City Scheduling
- LC 1153. String Transforms Into Another String
- LC 1167. Minimum Cost to Connect Sticks
- LC 1183. Maximum Number of Ones
- LC 1231. Divide Chocolate
- LC 1282. Group the People Given the Group Size They Belong To
- LC 1288. Remove Covered Intervals
- LC 1326. Minimum Number of Taps to Open to Water a Garden
- LC 1328. Break a Palindrome
- LC 1380. Lucky Numbers in a Matrix
- LC 1383. Maximum Performance of a Team
- LC 1402. Reducing Dishes
- LC 1404. Number of Steps to Reduce a Number in Binary Representation to One
- LC 1509. Minimum Difference Between Largest and Smallest Value in Three Moves
- LC 1561. Maximum Number of Coins You Can Get
- LC 1605. Find Valid Matrix Given Row and Column Sums
- LC 1717. Maximum Score From Removing Substrings
- LC 1791. Find Center of Star Graph
- LC 1793. Maximum Score of a Good Subarray
- LC 1802. Maximum Value at a Given Index in a Bounded Array
- LC 1833. Maximum Ice Cream Bars
- LC 1846. Maximum Element After Decreasing and Rearranging
- LC 1962. Remove Stones to Minimize the Total
- LC 1964. Find the Longest Valid Obstacle Course at Each Position
- LC 1992. Find All Groups of Farmland
- LC 1996. The Number of Weak Characters in the Game
- LC 2037. Minimum Number of Moves to Seat Everyone
- LC 2054. Two Best Non-Overlapping Events
- LC 2064. Minimized Maximum of Products Distributed to Any Store
- LC 2125. Number of Laser Beams in a Bank
- LC 2136. Earliest Possible Day of Full Bloom
- LC 2182. Construct String With Repeat Limit
- LC 2214. Minimum Health to Beat Game
- LC 2279. Maximum Bags With Full Capacity of Rocks
- LC 2366. Minimum Replacements to Sort the Array
- LC 2393. Count Strictly Increasing Subarrays
- LC 2405. Optimal Partition of String
- LC 2439. Minimize Maximum of Array
- LC 2616. Minimize the Maximum Difference of Pairs
- LC 2706. Buy Two Chocolates
- LC 2782. Number of Unique Categories
- LC 2812. Find the Safest Path in a Grid
- LC 2914. Minimum Number of Changes to Make Binary String Beautiful
- LC 3016. Minimum Number of Pushes to Type Word II
- LC 3068. Find the Maximum Sum of Node Values
- LC 3075. Maximize Happiness of Selected Children
Hadlock
Hashmap
- LC 15. 3Sum
- LC 18. 4Sum
- LC 30. Substring with Concatenation of All Words
- LC 36. Valid Sudoku
- LC 49. Group Anagrams
- LC 128. Longest Consecutive Sequence
- LC 136. Single Number
- LC 137. Single Number II
- LC 141. Linked List Cycle
- LC 142. Linked List Cycle II
- LC 160. Intersection of Two Linked Lists
- LC 169. Majority Element
- LC 170. Two Sum III - Data structure design
- LC 202. Happy Number
- LC 205. Isomorphic Strings
- LC 217. Contains Duplicate
- LC 219. Contains Duplicate II
- LC 249. Group Shifted Strings
- LC 260. Single Number III
- LC 264. Ugly Number II
- LC 266. Palindrome Permutation
- LC 268. Missing Number
- LC 287. Find the Duplicate Number
- LC 288. Unique Word Abbreviation
- LC 290. Word Pattern
- LC 291. Word Pattern II
- LC 299. Bulls and Cows
- LC 336. Palindrome Pairs
- LC 350. Intersection of Two Arrays II
- LC 359. Logger Rate Limiter
- LC 379. Design Phone Directory
- LC 380. Insert Delete GetRandom O(1)
- LC 381. Insert Delete GetRandom O(1) - Duplicates allowed
- LC 383. Ransom Note
- LC 387. First Unique Character in a String
- LC 389. Find the Difference
- LC 412. Fizz Buzz
- LC 423. Reconstruct Original Digits from English
- LC 448. Find All Numbers Disappeared in an Array
- LC 454. 4Sum II
- LC 460. LFU Cache
- LC 501. Find Mode in Binary Search Tree
- LC 525. Contiguous Array
- LC 532. K-diff Pairs in an Array
- LC 554. Brick Wall
- LC 567. Permutation in String
- LC 575. Distribute Candies
- LC 582. Kill Process
- LC 594. Longest Harmonious Subsequence
- LC 599. Minimum Index Sum of Two Lists
- LC 609. Find Duplicate File in System
- LC 648. Replace Words
- LC 653. Two Sum IV - Input is a BST
- LC 709. To Lower Case
- LC 733. Flood Fill
- LC 760. Find Anagram Mappings
- LC 771. Jewels and Stones
- LC 804. Unique Morse Code Words
- LC 811. Subdomain Visit Count
- LC 822. Card Flipping Game
- LC 966. Vowel Spellchecker
- LC 981. Time Based Key-Value Store
- LC 1065. Index Pairs of a String
- LC 1072. Flip Columns For Maximum Number of Equal Rows
- LC 1122. Relative Sort Array
- LC 1207. Unique Number of Occurrences
- LC 1214. Two Sum BSTs
- LC 1233. Remove Sub-Folders from the Filesystem
- LC 1248. Count Number of Nice Subarrays
- LC 1287. Element Appearing More Than 25% In Sorted Array
- LC 1329. Sort the Matrix Diagonally
- LC 1331. Rank Transform of an Array
- LC 1338. Reduce Array Size to The Half
- LC 1347. Minimum Number of Steps to Make Two Strings Anagram
- LC 1396. Design Underground System
- LC 1436. Destination City
- LC 1461. Check If a String Contains All Binary Codes of Size K
- LC 1496. Path Crossing
- LC 1497. Check If Array Pairs Are Divisible by k
- LC 1512. Number of Good Pairs
- LC 1570. Dot Product of Two Sparse Vectors
- LC 1624. Largest Substring Between Two Equal Characters
- LC 1640. Check Array Formation Through Concatenation
- LC 1657. Determine if Two Strings Are Close
- LC 1679. Max Number of K-Sum Pairs
- LC 1684. Count the Number of Consistent Strings
- LC 1836. Remove Duplicates From an Unsorted Linked List
- LC 1858. Longest Word With All Prefixes
- LC 1940. Longest Common Subsequence Between Sorted Arrays
- LC 2007. Find Original Array From Doubled Array
- LC 2053. Kth Distinct String in an Array
- LC 2131. Longest Palindrome by Concatenating Two Letter Words
- LC 2215. Find the Difference of Two Arrays
- LC 2225. Find Players With Zero or One Losses
- LC 2336. Smallest Number in Infinite Set
- LC 2352. Equal Row and Column Pairs
- LC 2353. Design a Food Rating System
- LC 2391. Minimum Amount of Time to Collect Garbage
- LC 2425. Bitwise XOR of All Pairings
- LC 2471. Minimum Number of Operations to Sort a Binary Tree by Level
- LC 2501. Longest Square Streak in an Array
- LC 2540. Minimum Common Value
- LC 2554. Maximum Number of Integers to Choose From a Range I
- LC 2657. Find the Prefix Common Array of Two Arrays
- LC 2982. Find Longest Special Substring That Occurs Thrice II
- LC 3043. Find the Length of the Longest Common Prefix
- LC 3063. Linked List Frequency
- LC 3217. Delete Nodes From Linked List Present in Array
Hashmap (one pass)
Hashmap (two pass)
Heap (priority queue)
- LC 23. Merge k Sorted Lists
- LC 215. Kth Largest Element in an Array
- LC 218. The Skyline Problem
- LC 253. Meeting Rooms II
- LC 264. Ugly Number II
- LC 272. Closest Binary Search Tree Value II
- LC 295. Find Median from Data Stream
- LC 347. Top K Frequent Elements
- LC 358. Rearrange String k Distance Apart
- LC 373. Find K Pairs with Smallest Sums
- LC 378. Kth Smallest Element in a Sorted Matrix
- LC 414. Third Maximum Number
- LC 480. Sliding Window Median
- LC 506. Relative Ranks
- LC 621. Task Scheduler
- LC 630. Course Schedule III
- LC 632. Smallest Range Covering Elements from K Lists
- LC 642. Design Search Autocomplete System
- LC 659. Split Array into Consecutive Subsequences
- LC 668. Kth Smallest Number in Multiplication Table
- LC 683. K Empty Slots
- LC 692. Top K Frequent Words
- LC 703. Kth Largest Element in a Stream
- LC 716. Max Stack
- LC 759. Employee Free Time
- LC 767. Reorganize String
- LC 774. Minimize Max Distance to Gas Station
- LC 778. Swim in Rising Water
- LC 786. K-th Smallest Prime Fraction
- LC 857. Minimum Cost to Hire K Workers
- LC 862. Shortest Subarray with Sum at Least K
- LC 871. Minimum Number of Refueling Stops
- LC 973. K Closest Points to Origin
- LC 1046. Last Stone Weight
- LC 1057. Campus Bikes
- LC 1066. Campus Bikes II
- LC 1086. High Five
- LC 1102. Path With Maximum Minimum Value
- LC 1196. How Many Apples Can You Put into the Basket
- LC 1229. Meeting Scheduler
- LC 1235. Maximum Profit in Job Scheduling
- LC 1244. Design A Leaderboard
- LC 1329. Sort the Matrix Diagonally
- LC 1337. The K Weakest Rows in a Matrix
- LC 1383. Maximum Performance of a Team
- LC 1405. Longest Happy String
- LC 1425. Constrained Subsequence Sum
- LC 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- LC 1481. Least Number of Unique Integers after K Removals
- LC 1508. Range Sum of Sorted Subarray Sums
- LC 1606. Find Servers That Handled Most Number of Requests
- LC 1642. Furthest Building You Can Reach
- LC 1647. Minimum Deletions to Make Character Frequencies Unique
- LC 1675. Minimize Deviation in Array
- LC 1696. Jump Game VI
- LC 1705. Maximum Number of Eaten Apples
- LC 1710. Maximum Units on a Truck
- LC 1792. Maximum Average Pass Ratio
- LC 1834. Single-Threaded CPU
- LC 1845. Seat Reservation Manager
- LC 1874. Minimize Product Sum of Two Arrays
- LC 1921. Eliminate Maximum Number of Monsters
- LC 1942. The Number of the Smallest Unoccupied Chair
- LC 1962. Remove Stones to Minimize the Total
- LC 2034. Stock Price Fluctuation
- LC 2054. Two Best Non-Overlapping Events
- LC 2064. Minimized Maximum of Products Distributed to Any Store
- LC 2182. Construct String With Repeat Limit
- LC 2251. Number of Flowers in Full Bloom
- LC 2336. Smallest Number in Infinite Set
- LC 2353. Design a Food Rating System
- LC 2371. Minimize Maximum Value in a Grid
- LC 2402. Meeting Rooms III
- LC 2406. Divide Intervals Into Minimum Number of Groups
- LC 2462. Total Cost to Hire K Workers
- LC 2530. Maximal Score After Applying K Operations
- LC 2542. Maximum Subsequence Score
- LC 2558. Take Gifts From the Richest Pile
- LC 2582. Pass the Pillow
- LC 2593. Find Score of an Array After Marking All Elements
- LC 2762. Continuous Subarrays
- LC 2940. Find Building Where Alice and Bob Can Meet
- LC 3016. Minimum Number of Pushes to Type Word II
- LC 3075. Maximize Happiness of Selected Children
- LC 3264. Final Array State After K Multiplication Operations I
Heapsort
Hierholzer
Horizontal scanning
Index as hash key
Insertion sort
Integer overflow
- LC 7. Reverse Integer
- LC 8. String to Integer (atoi)
- LC 29. Divide Two Integers
- LC 1339. Maximum Product of Splitted Binary Tree
Interval stabbing
Inverse Burrows-Wheeler transform
Jarvis
JavaScript
- LC 2618. Check if Object Instance of Class
- LC 2619. Array Prototype Last
- LC 2620. Counter
- LC 2621. Sleep
- LC 2622. Cache With Time Limit
- LC 2623. Memoize
- LC 2624. Snail Traversal
- LC 2625. Flatten Deeply Nested Array
- LC 2626. Array Reduce Transformation
- LC 2627. Debounce
- LC 2628. JSON Deep Equal
- LC 2629. Function Composition
- LC 2630. Memoize II
- LC 2631. Group By
- LC 2632. Curry
- LC 2633. Convert Object to JSON String
- LC 2634. Filter Elements from Array
- LC 2635. Apply Transform Over Each Element in Array
- LC 2636. Promise Pool
- LC 2637. Promise Time Limit
- LC 2648. Generate Fibonacci Sequence
- LC 2649. Nested Array Generator
- LC 2665. Counter II
- LC 2666. Allow One Function Call
- LC 2667. Create Hello World Function
- LC 2675. Array of Objects to Matrix
- LC 2676. Throttle
- LC 2677. Chunk Array
- LC 2690. Infinite Method Object
- LC 2692. Make Object Immutable
- LC 2693. Call Function with Custom Context
- LC 2694. Event Emitter
- LC 2695. Array Wrapper
- LC 2703. Return Length of Arguments Passed
- LC 2704. To Be Or Not To Be
- LC 2705. Compact Object
- LC 2715. Timeout Cancellation
- LC 2721. Execute Asynchronous Functions in Parallel
- LC 2722. Join Two Arrays by ID
- LC 2723. Add Two Promises
- LC 2724. Sort By
- LC 2725. Interval Cancellation
- LC 2726. Calculator with Method Chaining
- LC 2727. Is Object Empty
- LC 2754. Bind Function to Context
- LC 2755. Deep Merge of Two Objects
- LC 2756. Query Batching
- LC 2757. Generate Circular Array Values
- LC 2758. Next Day
- LC 2759. Convert JSON String to Object
- LC 2794. Create Object from Two Arrays
- LC 2795. Parallel Execution of Promises for Individual Results Retrieval
- LC 2796. Repeat String
- LC 2803. Factorial Generator
- LC 2804. Array Prototype ForEach
- LC 2805. Custom Interval
- LC 2821. Delay the Resolution of Each Promise
- LC 2823. Deep Object Filter
Kadane
- LC 53. Maximum Subarray
- LC 363. Max Sum of Rectangle No Larger Than K
- LC 2272. Substring With Largest Variance
Karnaugh map
KMP (Knuth-Morris-Pratt)
- LC 28. Find the Index of the First Occurrence in a String
- LC 214. Shortest Palindrome
- LC 796. Rotate String
- LC 1367. Linked List in Binary Tree
- LC 1408. String Matching in an Array
Line sweep
- LC 218. The Skyline Problem
- LC 731. My Calendar II
- LC 732. My Calendar III
- LC 759. Employee Free Time
- LC 850. Rectangle Area II
- LC 1272. Remove Interval
- LC 2406. Divide Intervals Into Minimum Number of Groups
- LC 2554. Maximum Number of Integers to Choose From a Range I
- LC 2779. Maximum Beauty of an Array After Applying Operation
Linear algebra
Linear transformation
Manacher
Manhattan distance
Math
- LC 2. Add Two Numbers
- LC 7. Reverse Integer
- LC 9. Palindrome Number
- LC 29. Divide Two Integers
- LC 43. Multiply Strings
- LC 62. Unique Paths
- LC 66. Plus One
- LC 69. Sqrt(x)
- LC 96. Unique Binary Search Trees
- LC 119. Pascal''s Triangle II
- LC 136. Single Number
- LC 137. Single Number II
- LC 149. Max Points on a Line
- LC 166. Fraction to Recurring Decimal
- LC 172. Factorial Trailing Zeroes
- LC 223. Rectangle Area
- LC 233. Number of Digit One
- LC 258. Add Digits
- LC 279. Perfect Squares
- LC 319. Bulb Switcher
- LC 326. Power of Three
- LC 330. Patching Array
- LC 342. Power of Four
- LC 343. Integer Break
- LC 367. Valid Perfect Square
- LC 368. Largest Divisible Subset
- LC 415. Add Strings
- LC 441. Arranging Coins
- LC 453. Minimum Moves to Equal Array Elements
- LC 459. Repeated Substring Pattern
- LC 478. Generate Random Point in a Circle
- LC 507. Perfect Number
- LC 509. Fibonacci Number
- LC 519. Random Flip Matrix
- LC 553. Optimal Division
- LC 621. Task Scheduler
- LC 625. Minimum Factorization
- LC 633. Sum of Square Numbers
- LC 634. Find the Derangement of An Array
- LC 650. 2 Keys Keyboard
- LC 660. Remove 9
- LC 672. Bulb Switcher II
- LC 699. Falling Squares
- LC 754. Reach a Number
- LC 779. K-th Symbol in Grammar
- LC 790. Domino and Tromino Tiling
- LC 810. Chalkboard XOR Game
- LC 816. Ambiguous Coordinates
- LC 829. Consecutive Numbers Sum
- LC 840. Magic Squares In Grid
- LC 858. Mirror Reflection
- LC 877. Stone Game
- LC 878. Nth Magical Number
- LC 883. Projection Area of 3D Shapes
- LC 887. Super Egg Drop
- LC 891. Sum of Subsequence Widths
- LC 899. Orderly Queue
- LC 902. Numbers At Most N Given Digit Set
- LC 906. Super Palindromes
- LC 908. Smallest Range I
- LC 920. Number of Music Playlists
- LC 1074. Number of Submatrices That Sum to Target
- LC 1103. Distribute Candies to People
- LC 1180. Count Substrings with Only One Distinct Letter
- LC 1232. Check If It Is a Straight Line
- LC 1260. Shift 2D Grid
- LC 1265. Print Immutable Linked List in Reverse
- LC 1295. Find Numbers with Even Number of Digits
- LC 1323. Maximum 69 Number
- LC 1344. Angle Between Hands of a Clock
- LC 1359. Count All Valid Pickup and Delivery Options
- LC 1523. Count Odd Numbers in an Interval Range
- LC 1551. Minimum Operations to Make Array Equal
- LC 1611. Minimum One Bit Operations to Make Integers Zero
- LC 1641. Count Sorted Vowel Strings
- LC 1680. Concatenation of Consecutive Binary Numbers
- LC 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers
- LC 1716. Calculate Money in Leetcode Bank
- LC 2022. Convert 1D Array Into 2D Array
- LC 2028. Find Missing Observations
- LC 2147. Number of Ways to Divide a Long Corridor
- LC 2485. Find the Pivot Integer
- LC 2582. Pass the Pillow
- LC 2849. Determine if a Cell Is Reachable at a Given Time
Matrix
- LC 36. Valid Sudoku
- LC 48. Rotate Image
- LC 54. Spiral Matrix
- LC 59. Spiral Matrix II
- LC 73. Set Matrix Zeroes
- LC 74. Search a 2D Matrix
- LC 304. Range Sum Query 2D - Immutable
- LC 311. Sparse Matrix Multiplication
Matrix chain multiplication
Matrix (Yale)
Meet in the middle
Merge sort
- LC 4. Median of Two Sorted Arrays
- LC 88. Merge Sorted Array
- LC 148. Sort List
- LC 179. Largest Number
- LC 315. Count of Smaller Numbers After Self
- LC 493. Reverse Pairs
- LC 912. Sort an Array
- LC 1051. Height Checker
- LC 1649. Create Sorted Array through Instructions
- LC 2418. Sort the People
Minimax
Monotone chain
Monotonic deque
- LC 239. Sliding Window Maximum
- LC 1425. Constrained Subsequence Sum
- LC 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- LC 2762. Continuous Subarrays
Monotonic stack
- LC 84. Largest Rectangle in Histogram
- LC 85. Maximal Rectangle
- LC 255. Verify Preorder Sequence in Binary Search Tree
- LC 496. Next Greater Element I
- LC 739. Daily Temperatures
- LC 769. Max Chunks To Make Sorted
- LC 862. Shortest Subarray with Sum at Least K
- LC 901. Online Stock Span
- LC 907. Sum of Subarray Minimums
- LC 962. Maximum Width Ramp
- LC 975. Odd Even Jump
- LC 1019. Next Greater Node In Linked List
- LC 1063. Number of Valid Subarrays
- LC 1335. Minimum Difficulty of a Job Schedule
- LC 1475. Final Prices With a Special Discount in a Shop
- LC 1762. Buildings With an Ocean View
- LC 1793. Maximum Score of a Good Subarray
- LC 2104. Sum of Subarray Ranges
- LC 2281. Sum of Total Strength of Wizards
- LC 2832. Maximal Range That Each Element Is Maximum in It
- LC 2940. Find Building Where Alice and Bob Can Meet
Morris traversal
- LC 94. Binary Tree Inorder Traversal
- LC 99. Recover Binary Search Tree
- LC 129. Sum Root to Leaf Numbers
- LC 144. Binary Tree Preorder Traversal
- LC 145. Binary Tree Postorder Traversal
- LC 404. Sum of Left Leaves
- LC 538. Convert BST to Greater Tree
- LC 1022. Sum of Root To Leaf Binary Numbers
- LC 1038. Binary Search Tree to Greater Sum Tree
- LC 1214. Two Sum BSTs
MST (Kruskal)
- LC 778. Swim in Rising Water
- LC 1135. Connecting Cities With Minimum Cost
- LC 1168. Optimize Water Distribution in a Village
- LC 1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
- LC 1584. Min Cost to Connect All Points
MST (Prim)
Multiset
- LC 451. Sort Characters By Frequency
- LC 480. Sliding Window Median
- LC 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
Ordered map
- LC 352. Data Stream as Disjoint Intervals
- LC 1331. Rank Transform of an Array
- LC 1705. Maximum Number of Eaten Apples
- LC 2034. Stock Price Fluctuation
- LC 2418. Sort the People
- LC 2762. Continuous Subarrays
Ordered set
- LC 352. Data Stream as Disjoint Intervals
- LC 414. Third Maximum Number
- LC 1845. Seat Reservation Manager
Palindrome
- LC 5. Longest Palindromic Substring
- LC 132. Palindrome Partitioning II
- LC 214. Shortest Palindrome
- LC 266. Palindrome Permutation
- LC 336. Palindrome Pairs
- LC 564. Find the Closest Palindrome
- LC 680. Valid Palindrome II
- LC 730. Count Different Palindromic Subsequences
- LC 1216. Valid Palindrome III
- LC 1332. Remove Palindromic Subsequences
- LC 1400. Construct K Palindrome Strings
Pandas
- LC 2877. Create a DataFrame from List
- LC 2878. Get the Size of a DataFrame
- LC 2879. Display the First Three Rows
- LC 2880. Select Data
- LC 2881. Create a New Column
- LC 2882. Drop Duplicate Rows
- LC 2883. Drop Missing Data
- LC 2884. Modify Columns
- LC 2885. Rename Columns
- LC 2886. Change Data Type
- LC 2887. Fill Missing Data
- LC 2888. Reshape Data: Concatenate
- LC 2889. Reshape Data: Pivot
- LC 2890. Reshape Data: Melt
- LC 2891. Method Chaining
Pigeonhole principle
Prefix product
Prefix sum
- LC 303. Range Sum Query - Immutable
- LC 325. Maximum Size Subarray Sum Equals k
- LC 363. Max Sum of Rectangle No Larger Than K
- LC 497. Random Point in Non-overlapping Rectangles
- LC 528. Random Pick with Weight
- LC 724. Find Pivot Index
- LC 769. Max Chunks To Make Sorted
- LC 848. Shifting Letters
- LC 918. Maximum Sum Circular Subarray
- LC 930. Binary Subarrays With Sum
- LC 974. Subarray Sums Divisible by K
- LC 1074. Number of Submatrices That Sum to Target
- LC 1171. Remove Zero Sum Consecutive Nodes from Linked List
- LC 1413. Minimum Value to Get Positive Step by Step Sum
- LC 1420. Build Array Where You Can Find The Maximum Exactly K Comparisons
- LC 1530. Number of Good Leaf Nodes Pairs
- LC 1590. Make Sum Divisible by P
- LC 1608. Special Array With X Elements Greater Than or Equal X
- LC 1685. Sum of Absolute Differences in a Sorted Array
- LC 1732. Find the Highest Altitude
- LC 1829. Maximum XOR for Each Query
- LC 1894. Find the Student that Will Replace the Chalk
- LC 2083. Substrings That Begin and End With the Same Letter
- LC 2090. K Radius Subarray Averages
- LC 2256. Minimum Average Difference
- LC 2270. Number of Ways to Split Array
- LC 2281. Sum of Total Strength of Wizards
- LC 2439. Minimize Maximum of Array
- LC 2448. Minimum Cost to Make Array Equal
- LC 2559. Count Vowel Strings in Ranges
- LC 2838. Maximum Coins Heroes Can Collect
- LC 2955. Number of Same-End Substrings
- LC 3152. Special Array II
Prefix sum (hashing)
- LC 325. Maximum Size Subarray Sum Equals k
- LC 437. Path Sum III
- LC 523. Continuous Subarray Sum
- LC 560. Subarray Sum Equals K
- LC 677. Map Sum Pairs
- LC 1171. Remove Zero Sum Consecutive Nodes from Linked List
- LC 1695. Maximum Erasure Value
Prefix sum (space optimized)
- LC 303. Range Sum Query - Immutable
- LC 1685. Sum of Absolute Differences in a Sorted Array
- LC 2256. Minimum Average Difference
- LC 2270. Number of Ways to Split Array
Queue
- LC 225. Implement Stack using Queues
- LC 281. Zigzag Iterator
- LC 359. Logger Rate Limiter
- LC 362. Design Hit Counter
- LC 379. Design Phone Directory
- LC 566. Reshape the Matrix
- LC 649. Dota2 Senate
- LC 950. Reveal Cards In Increasing Order
- LC 1429. First Unique Number
- LC 1535. Find the Winner of an Array Game
- LC 1700. Number of Students Unable to Eat Lunch
- LC 1823. Find the Winner of the Circular Game
- LC 2073. Time Needed to Buy Tickets
- LC 2337. Move Pieces to Obtain a String
Quickselect
- LC 215. Kth Largest Element in an Array
- LC 347. Top K Frequent Elements
- LC 462. Minimum Moves to Equal Array Elements II
- LC 973. K Closest Points to Origin
Quicksort
Rabin-Karp (binary search)
Rabin-Karp (single hash)
Rabin-Karp (double hash)
Rabin-Karp (rolling hash)
Radix sort
- LC 164. Maximum Gap
- LC 360. Sort Transformed Array
- LC 912. Sort an Array
- LC 1051. Height Checker
- LC 1062. Longest Repeating Substring
Recursion
- LC 10. Regular Expression Matching
- LC 21. Merge Two Sorted Lists
- LC 24. Swap Nodes in Pairs
- LC 25. Reverse Nodes in k-Group
- LC 50. Pow(x, n)
- LC 72. Edit Distance
- LC 89. Gray Code
- LC 92. Reverse Linked List II
- LC 98. Validate Binary Search Tree
- LC 100. Same Tree
- LC 241. Different Ways to Add Parentheses
- LC 247. Strobogrammatic Number II
- LC 273. Integer to English Words
- LC 654. Maximum Binary Tree
Regex
- LC 38. Count and Say
- LC 468. Validate IP Address
- LC 520. Detect Capital
- LC 551. Student Attendance Record I
- LC 591. Tag Validator
- LC 592. Fraction Addition and Subtraction
- LC 640. Solve the Equation
- LC 726. Number of Atoms
Rejection sampling
Reservoir sampling
Rolling hash
- LC 214. Shortest Palindrome
- LC 718. Maximum Length of Repeated Subarray
- LC 2168. Unique Substrings With Equal Digit Frequency
Segment tree
- LC 307. Range Sum Query - Mutable
- LC 315. Count of Smaller Numbers After Self
- LC 699. Falling Squares
- LC 732. My Calendar III
- LC 850. Rectangle Area II
- LC 1649. Create Sorted Array through Instructions
- LC 1696. Jump Game VI
Sieve of Eratosthenes
Simulation
- LC 6. Zigzag Conversion
- LC 123. Best Time to Buy and Sell Stock III
- LC 383. Ransom Note
- LC 498. Diagonal Traverse
- LC 544. Output Contest Matches
- LC 657. Robot Return to Origin
- LC 681. Next Closest Time
- LC 749. Contain Virus
- LC 755. Pour Water
- LC 799. Champagne Tower
- LC 858. Mirror Reflection
- LC 860. Lemonade Change
- LC 874. Walking Robot Simulation
- LC 885. Spiral Matrix III
- LC 950. Reveal Cards In Increasing Order
- LC 957. Prison Cells After N Days
- LC 1260. Shift 2D Grid
- LC 1342. Number of Steps to Reduce a Number to Zero
- LC 1380. Lucky Numbers in a Matrix
- LC 1404. Number of Steps to Reduce a Number in Binary Representation to One
- LC 1427. Perform String Shifts
- LC 1441. Build an Array With Stack Operations
- LC 1518. Water Bottles
- LC 1535. Find the Winner of an Array Game
- LC 1561. Maximum Number of Coins You Can Get
- LC 1675. Minimize Deviation in Array
- LC 1688. Count of Matches in Tournament
- LC 1700. Number of Students Unable to Eat Lunch
- LC 1701. Average Waiting Time
- LC 1706. Where Will the Ball Fall
- LC 1716. Calculate Money in Leetcode Bank
- LC 1908. Game of Nim
- LC 2022. Convert 1D Array Into 2D Array
- LC 2061. Number of Spaces Cleaning Robot Cleaned
- LC 2073. Time Needed to Buy Tickets
- LC 2257. Count Unguarded Cells in the Grid
- LC 2326. Spiral Matrix IV
- LC 2373. Largest Local Values in a Matrix
- LC 2582. Pass the Pillow
- LC 2807. Insert Greatest Common Divisors in Linked List
Sliding window
- LC 3. Longest Substring Without Repeating Characters
- LC 28. Find the Index of the First Occurrence in a String
- LC 30. Substring with Concatenation of All Words
- LC 76. Minimum Window Substring
- LC 159. Longest Substring with At Most Two Distinct Characters
- LC 209. Minimum Size Subarray Sum
- LC 272. Closest Binary Search Tree Value II
- LC 340. Longest Substring with At Most K Distinct Characters
- LC 395. Longest Substring with At Least K Repeating Characters
- LC 424. Longest Repeating Character Replacement
- LC 438. Find All Anagrams in a String
- LC 487. Max Consecutive Ones II
- LC 567. Permutation in String
- LC 643. Maximum Average Subarray I
- LC 658. Find K Closest Elements
- LC 674. Longest Continuous Increasing Subsequence
- LC 683. K Empty Slots
- LC 689. Maximum Sum of 3 Non-Overlapping Subarrays
- LC 713. Subarray Product Less Than K
- LC 719. Find K-th Smallest Pair Distance
- LC 768. Max Chunks To Make Sorted II
- LC 904. Fruit Into Baskets
- LC 930. Binary Subarrays With Sum
- LC 933. Number of Recent Calls
- LC 978. Longest Turbulent Subarray
- LC 992. Subarrays with K Different Integers
- LC 1004. Max Consecutive Ones III
- LC 1052. Grumpy Bookstore Owner
- LC 1100. Find K-Length Substrings With No Repeated Characters
- LC 1151. Minimum Swaps to Group All 1''s Together
- LC 1208. Get Equal Substrings Within Budget
- LC 1248. Count Number of Nice Subarrays
- LC 1291. Sequential Digits
- LC 1423. Maximum Points You Can Obtain from Cards
- LC 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- LC 1456. Maximum Number of Vowels in a Substring of Given Length
- LC 1493. Longest Subarray of 1''s After Deleting One Element
- LC 1508. Range Sum of Sorted Subarray Sums
- LC 1652. Defuse the Bomb
- LC 1675. Minimize Deviation in Array
- LC 1838. Frequency of the Most Frequent Element
- LC 2009. Minimum Number of Operations to Make Array Continuous
- LC 2024. Maximize the Confusion of an Exam
- LC 2090. K Radius Subarray Averages
- LC 2107. Number of Unique Flavors After Sharing K Candies
- LC 2134. Minimum Swaps to Group All 1''s Together II
- LC 2461. Maximum Sum of Distinct Subarrays With Length K
- LC 2516. Take K of Each Character From Left and Right
- LC 2593. Find Score of an Array After Marking All Elements
- LC 2743. Count Substrings Without Repeating Character
- LC 2779. Maximum Beauty of an Array After Applying Operation
- LC 2958. Length of Longest Subarray With at Most K Frequency
- LC 2962. Count Subarrays Where Max Element Appears at Least K Times
- LC 3097. Shortest Subarray With OR at Least K II
- LC 3152. Special Array II
- LC 3254. Find the Power of K-Size Subarrays I
Sliding window (optimized)
- LC 3. Longest Substring Without Repeating Characters
- LC 76. Minimum Window Substring
- LC 424. Longest Repeating Character Replacement
- LC 567. Permutation in String
- LC 1248. Count Number of Nice Subarrays
Sorting
- LC 49. Group Anagrams
- LC 56. Merge Intervals
- LC 75. Sort Colors
- LC 99. Recover Binary Search Tree
- LC 128. Longest Consecutive Sequence
- LC 137. Single Number II
- LC 164. Maximum Gap
- LC 169. Majority Element
- LC 170. Two Sum III - Data structure design
- LC 215. Kth Largest Element in an Array
- LC 217. Contains Duplicate
- LC 242. Valid Anagram
- LC 244. Shortest Word Distance II
- LC 251. Flatten 2D Vector
- LC 268. Missing Number
- LC 272. Closest Binary Search Tree Value II
- LC 274. H-Index
- LC 280. Wiggle Sort
- LC 287. Find the Duplicate Number
- LC 295. Find Median from Data Stream
- LC 296. Best Meeting Point
- LC 349. Intersection of Two Arrays
- LC 350. Intersection of Two Arrays II
- LC 354. Russian Doll Envelopes
- LC 360. Sort Transformed Array
- LC 366. Find Leaves of Binary Tree
- LC 383. Ransom Note
- LC 389. Find the Difference
- LC 414. Third Maximum Number
- LC 451. Sort Characters By Frequency
- LC 453. Minimum Moves to Equal Array Elements
- LC 462. Minimum Moves to Equal Array Elements II
- LC 480. Sliding Window Median
- LC 506. Relative Ranks
- LC 524. Longest Word in Dictionary through Deleting
- LC 539. Minimum Time Difference
- LC 561. Array Partition
- LC 567. Permutation in String
- LC 575. Distribute Candies
- LC 581. Shortest Unsorted Continuous Subarray
- LC 593. Valid Square
- LC 594. Longest Harmonious Subsequence
- LC 621. Task Scheduler
- LC 628. Maximum Product of Three Numbers
- LC 645. Set Mismatch
- LC 658. Find K Closest Elements
- LC 791. Custom Sort String
- LC 853. Car Fleet
- LC 905. Sort Array By Parity
- LC 937. Reorder Data in Log Files
- LC 939. Minimum Area Rectangle
- LC 945. Minimum Increment to Make Array Unique
- LC 948. Bag of Tokens
- LC 962. Maximum Width Ramp
- LC 973. K Closest Points to Origin
- LC 976. Largest Perimeter Triangle
- LC 977. Squares of a Sorted Array
- LC 1057. Campus Bikes
- LC 1062. Longest Repeating Substring
- LC 1086. High Five
- LC 1122. Relative Sort Array
- LC 1133. Largest Unique Number
- LC 1196. How Many Apples Can You Put into the Basket
- LC 1200. Minimum Absolute Difference
- LC 1233. Remove Sub-Folders from the Filesystem
- LC 1235. Maximum Profit in Job Scheduling
- LC 1331. Rank Transform of an Array
- LC 1337. The K Weakest Rows in a Matrix
- LC 1338. Reduce Array Size to The Half
- LC 1346. Check If N and Its Double Exist
- LC 1356. Sort Integers by The Number of 1 Bits
- LC 1394. Find Lucky Integer in an Array
- LC 1460. Make Two Arrays Equal by Reversing Subarrays
- LC 1464. Maximum Product of Two Elements in an Array
- LC 1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
- LC 1497. Check If Array Pairs Are Divisible by k
- LC 1509. Minimum Difference Between Largest and Smallest Value in Three Moves
- LC 1608. Special Array With X Elements Greater Than or Equal X
- LC 1630. Arithmetic Subarrays
- LC 1632. Rank Transform of a Matrix
- LC 1636. Sort Array by Increasing Frequency
- LC 1637. Widest Vertical Area Between Two Points Containing No Points
- LC 1647. Minimum Deletions to Make Character Frequencies Unique
- LC 1675. Minimize Deviation in Array
- LC 1679. Max Number of K-Sum Pairs
- LC 1727. Largest Submatrix With Rearrangements
- LC 1833. Maximum Ice Cream Bars
- LC 1877. Minimize Maximum Pair Sum in Array
- LC 1887. Reduction Operations to Make the Array Elements Equal
- LC 1913. Maximum Product Difference Between Two Pairs
- LC 1921. Eliminate Maximum Number of Monsters
- LC 1996. The Number of Weak Characters in the Game
- LC 2007. Find Original Array From Doubled Array
- LC 2037. Minimum Number of Moves to Seat Everyone
- LC 2070. Most Beautiful Item for Each Query
- LC 2191. Sort the Jumbled Numbers
- LC 2285. Maximum Total Importance of Roads
- LC 2300. Successful Pairs of Spells and Potions
- LC 2328. Number of Increasing Paths in a Grid
- LC 2371. Minimize Maximum Value in a Grid
- LC 2389. Longest Subsequence With Limited Sum
- LC 2402. Meeting Rooms III
- LC 2406. Divide Intervals Into Minimum Number of Groups
- LC 2418. Sort the People
- LC 2491. Divide Players Into Teams of Equal Skill
- LC 2551. Put Marbles in Bags
- LC 2593. Find Score of an Array After Marking All Elements
- LC 2751. Robot Collisions
- LC 2785. Sort Vowels in a String
- LC 2838. Maximum Coins Heroes Can Collect
- LC 2966. Divide Array Into Arrays With Max Difference
- LC 2971. Find Polygon With the Largest Perimeter
- LC 3016. Minimum Number of Pushes to Type Word II
- LC 3075. Maximize Happiness of Selected Children
- LC 3189. Minimum Moves to Get a Peaceful Board
Shortest path first algorithm (SPFA)
- LC 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
- LC 1514. Path with Maximum Probability
Stack
- LC 20. Valid Parentheses
- LC 32. Longest Valid Parentheses
- LC 42. Trapping Rain Water
- LC 71. Simplify Path
- LC 150. Evaluate Reverse Polish Notation
- LC 155. Min Stack
- LC 224. Basic Calculator
- LC 227. Basic Calculator II
- LC 232. Implement Queue using Stacks
- LC 316. Remove Duplicate Letters
- LC 341. Flatten Nested List Iterator
- LC 383. Ransom Note
- LC 394. Decode String
- LC 402. Remove K Digits
- LC 445. Add Two Numbers II
- LC 456. 132 Pattern
- LC 484. Find Permutation
- LC 503. Next Greater Element II
- LC 536. Construct Binary Tree from String
- LC 581. Shortest Unsorted Continuous Subarray
- LC 590. N-ary Tree Postorder Traversal
- LC 591. Tag Validator
- LC 606. Construct String from Binary Tree
- LC 636. Exclusive Time of Functions
- LC 678. Valid Parenthesis String
- LC 682. Baseball Game
- LC 726. Number of Atoms
- LC 735. Asteroid Collision
- LC 772. Basic Calculator III
- LC 856. Score of Parentheses
- LC 895. Maximum Frequency Stack
- LC 917. Reverse Only Letters
- LC 1047. Remove All Adjacent Duplicates In String
- LC 1106. Parsing A Boolean Expression
- LC 1209. Remove All Adjacent Duplicates in String II
- LC 1249. Minimum Remove to Make Valid Parentheses
- LC 1265. Print Immutable Linked List in Reverse
- LC 1472. Design Browser History
- LC 1544. Make The String Great
- LC 1598. Crawler Log Folder
- LC 1614. Maximum Nesting Depth of the Parentheses
- LC 1653. Minimum Deletions to Make String Balanced
- LC 1700. Number of Students Unable to Eat Lunch
- LC 1717. Maximum Score From Removing Substrings
- LC 1963. Minimum Number of Swaps to Make the String Balanced
- LC 2000. Reverse Prefix of Word
- LC 2116. Check if a Parentheses String Can Be Valid
- LC 2130. Maximum Twin Sum of a Linked List
- LC 2390. Removing Stars From a String
- LC 2487. Remove Nodes From Linked List
- LC 2696. Minimum String Length After Removing Substrings
- LC 2751. Robot Collisions
- LC 2816. Double a Number Represented as a Linked List
Suffix array
Suffix product
Suffix sum
Tarjan
Ternary search
Three pointers
- LC 75. Sort Colors
- LC 88. Merge Sorted Array
- LC 414. Third Maximum Number
- LC 689. Maximum Sum of 3 Non-Overlapping Subarrays
- LC 923. 3Sum With Multiplicity
- LC 1213. Intersection of Three Sorted Arrays
- LC 1214. Two Sum BSTs
- LC 1653. Minimum Deletions to Make String Balanced
Timsort
Topological sort
- LC 207. Course Schedule
- LC 210. Course Schedule II
- LC 269. Alien Dictionary
- LC 310. Minimum Height Trees
- LC 329. Longest Increasing Path in a Matrix
- LC 631. Design Excel Sum Formula
- LC 802. Find Eventual Safe States
- LC 1136. Parallel Courses
- LC 1203. Sort Items by Groups Respecting Dependencies
- LC 1857. Largest Color Value in a Directed Graph
- LC 2050. Parallel Courses III
- LC 2192. All Ancestors of a Node in a Directed Acyclic Graph
- LC 2360. Longest Cycle in a Graph
- LC 2392. Build a Matrix With Conditions
- LC 2872. Maximum Number of K-Divisible Components
- LC 3203. Find Minimum Diameter After Merging Two Trees
Topological sort (longest path)
Tree hash
Tree map
Tree (n-ary)
Trie
- LC 139. Word Break
- LC 140. Word Break II
- LC 208. Implement Trie (Prefix Tree)
- LC 211. Design Add and Search Words Data Structure
- LC 212. Word Search II
- LC 336. Palindrome Pairs
- LC 421. Maximum XOR of Two Numbers in an Array
- LC 425. Word Squares
- LC 440. K-th Smallest in Lexicographical Order
- LC 527. Word Abbreviation
- LC 642. Design Search Autocomplete System
- LC 648. Replace Words
- LC 677. Map Sum Pairs
- LC 692. Top K Frequent Words
- LC 720. Longest Word in Dictionary
- LC 745. Prefix and Suffix Search
- LC 820. Short Encoding of Words
- LC 1032. Stream of Characters
- LC 1065. Index Pairs of a String
- LC 1166. Design File System
- LC 1178. Number of Valid Words for Each Puzzle
- LC 1233. Remove Sub-Folders from the Filesystem
- LC 1268. Search Suggestions System
- LC 1408. String Matching in an Array
- LC 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
- LC 1858. Longest Word With All Prefixes
- LC 2168. Unique Substrings With Equal Digit Frequency
- LC 2185. Counting Words With a Given Prefix
- LC 2352. Equal Row and Column Pairs
- LC 2416. Sum of Prefix Scores of Strings
- LC 2707. Extra Characters in a String
- LC 3042. Count Prefix and Suffix Pairs I
- LC 3043. Find the Length of the Longest Common Prefix
Two pointer
- LC 11. Container With Most Water
- LC 15. 3Sum
- LC 16. 3Sum Closest
- LC 18. 4Sum
- LC 26. Remove Duplicates from Sorted Array
- LC 27. Remove Element
- LC 42. Trapping Rain Water
- LC 86. Partition List
- LC 125. Valid Palindrome
- LC 160. Intersection of Two Linked Lists
- LC 165. Compare Version Numbers
- LC 167. Two Sum II - Input Array Is Sorted
- LC 214. Shortest Palindrome
- LC 234. Palindrome Linked List
- LC 245. Shortest Word Distance III
- LC 246. Strobogrammatic Number
- LC 251. Flatten 2D Vector
- LC 259. 3Sum Smaller
- LC 281. Zigzag Iterator
- LC 283. Move Zeroes
- LC 295. Find Median from Data Stream
- LC 344. Reverse String
- LC 345. Reverse Vowels of a String
- LC 349. Intersection of Two Arrays
- LC 360. Sort Transformed Array
- LC 392. Is Subsequence
- LC 455. Assign Cookies
- LC 480. Sliding Window Median
- LC 484. Find Permutation
- LC 532. K-diff Pairs in an Array
- LC 557. Reverse Words in a String III
- LC 632. Smallest Range Covering Elements from K Lists
- LC 678. Valid Parenthesis String
- LC 680. Valid Palindrome II
- LC 708. Insert into a Sorted Circular Linked List
- LC 777. Swap Adjacent in LR String
- LC 826. Most Profit Assigning Work
- LC 830. Positions of Large Groups
- LC 844. Backspace String Compare
- LC 845. Longest Mountain in Array
- LC 849. Maximize Distance to Closest Person
- LC 876. Middle of the Linked List
- LC 925. Long Pressed Name
- LC 950. Reveal Cards In Increasing Order
- LC 962. Maximum Width Ramp
- LC 977. Squares of a Sorted Array
- LC 1055. Shortest Way to Form String
- LC 1099. Two Sum Less Than K
- LC 1209. Remove All Adjacent Duplicates in String II
- LC 1214. Two Sum BSTs
- LC 1229. Meeting Scheduler
- LC 1332. Remove Palindromic Subsequences
- LC 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
- LC 1497. Check If Array Pairs Are Divisible by k
- LC 1498. Number of Subsequences That Satisfy the Given Sum Condition
- LC 1544. Make The String Great
- LC 1574. Shortest Subarray to be Removed to Make Array Sorted
- LC 1578. Minimum Time to Make Rope Colorful
- LC 1634. Add Two Polynomials Represented as Linked Lists
- LC 1658. Minimum Operations to Reduce X to Zero
- LC 1669. Merge In Between Linked Lists
- LC 1679. Max Number of K-Sum Pairs
- LC 1695. Maximum Erasure Value
- LC 1750. Minimum Length of String After Deleting Similar Ends
- LC 1768. Merge Strings Alternately
- LC 1813. Sentence Similarity III
- LC 1855. Maximum Distance Between a Pair of Values
- LC 1885. Count Pairs in Two Arrays
- LC 1940. Longest Common Subsequence Between Sorted Arrays
- LC 1957. Delete Characters to Make Fancy String
- LC 2000. Reverse Prefix of Word
- LC 2095. Delete the Middle Node of a Linked List
- LC 2108. Find First Palindromic String in the Array
- LC 2109. Adding Spaces to a String
- LC 2149. Rearrange Array Elements by Sign
- LC 2181. Merge Nodes in Between Zeros
- LC 2300. Successful Pairs of Spells and Potions
- LC 2337. Move Pieces to Obtain a String
- LC 2390. Removing Stars From a String
- LC 2441. Largest Positive Integer That Exists With Its Negative
- LC 2444. Count Subarrays With Fixed Bounds
- LC 2485. Find the Pivot Integer
- LC 2486. Append Characters to String to Make Subsequence
- LC 2540. Minimum Common Value
- LC 2563. Count the Number of Fair Pairs
- LC 2762. Continuous Subarrays
- LC 2774. Array Upper Bound
- LC 2775. Undefined to Null
- LC 2776. Convert Callback Based Function to Promise Based Function
- LC 2777. Date Range Generator
- LC 2816. Double a Number Represented as a Linked List
- LC 2825. Make String a Subsequence Using Cyclic Increments
- LC 2938. Separate Black and White Balls
- LC 3062. Winner of the Linked List Game
Union-find
- LC 200. Number of Islands
- LC 218. The Skyline Problem
- LC 261. Graph Valid Tree
- LC 305. Number of Islands II
- LC 323. Number of Connected Components in an Undirected Graph
- LC 399. Evaluate Division
- LC 547. Number of Provinces
- LC 684. Redundant Connection
- LC 721. Accounts Merge
- LC 737. Sentence Similarity II
- LC 803. Bricks Falling When Hit
- LC 839. Similar String Groups
- LC 886. Possible Bipartition
- LC 924. Minimize Malware Spread
- LC 928. Minimize Malware Spread II
- LC 947. Most Stones Removed with Same Row or Column
- LC 952. Largest Component Size by Common Factor
- LC 959. Regions Cut By Slashes
- LC 990. Satisfiability of Equality Equations
- LC 1061. Lexicographically Smallest Equivalent String
- LC 1101. The Earliest Moment When Everyone Become Friends
- LC 1202. Smallest String With Swaps
- LC 1319. Number of Operations to Make Network Connected
- LC 1361. Validate Binary Tree Nodes
- LC 1579. Remove Max Number of Edges to Keep Graph Fully Traversable
- LC 1631. Path With Minimum Effort
- LC 1632. Rank Transform of a Matrix
- LC 1697. Checking Existence of Edge Length Limited Paths
- LC 1905. Count Sub Islands
- LC 1970. Last Day Where You Can Still Cross
- LC 1971. Find if Path Exists in Graph
- LC 2092. Find All People With Secret
- LC 2316. Count Unreachable Pairs of Nodes in an Undirected Graph
- LC 2368. Reachable Nodes With Restrictions
- LC 2421. Number of Good Paths
- LC 2492. Minimum Score of a Path Between Two Cities
- LC 2782. Number of Unique Categories
- LC 2852. Sum of Remoteness of All Cells