依題型整理我寫過解題筆記的 LeetCode 題目,點題名會開啟我的解題筆記(不是 LeetCode 原題頁)。同一題可能同時屬於多個題型。
難度
排序
篩選
資料結構
演算法
| # | 解題筆記 | 難度 | 刷次 | 資料結構 | 演算法 |
|---|---|---|---|---|---|
| 1 | ETwo Sum4 刷 | E | 4 | Hash Table | |
| 2 | MAdd Two Numbers | M | 1 | Linked List | DFSMath |
| 3 | MLongest Substring Without Repeating Characters2 刷 | M | 2 | StringHash Table | Two Pointers |
| 5 | MLongest Palindromic Substring3 刷 | M | 3 | String | Dynamic ProgrammingTwo Pointers |
| 7 | MReverse Integer | M | 1 | Math | |
| 9 | EPalindrome Number | E | 1 | Math | |
| 10 | HRegular Expression Matching | H | 1 | String | DFSDynamic Programming |
| 11 | MContainer With Most Water2 刷 | M | 2 | Two PointersGreedy | |
| 13 | ERoman to Integer | E | 1 | StringHash Table | Math |
| 15 | M3Sum2 刷 | M | 2 | Two PointersSorting | |
| 16 | M3Sum Closest | M | 1 | Two PointersSorting | |
| 17 | MLetter Combinations of a Phone Number | M | 1 | StringHash Table | Backtracking |
| 19 | MRemove Nth Node From End of List3 刷 | M | 3 | Linked List | Two Pointers |
| 20 | EValid Parentheses2 刷 | E | 2 | StringStack | |
| 21 | EMerge Two Sorted Lists2 刷 | E | 2 | Linked List | DFS |
| 22 | MGenerate Parentheses2 刷 | M | 2 | String | BacktrackingDynamic Programming |
| 28 | EImplement strStr() | E | 1 | String | Two Pointers |
| 31 | MNext Permutation | M | 1 | Two Pointers | |
| 32 | HLongest Valid Parentheses | H | 1 | StringStack | Dynamic Programming |
| 33 | MSearch in Rotated Sorted Array★4 刷 | M | 4 | Binary Search | |
| 34 | EFind First and Last Position of Element in Sorted Array | E | 1 | Binary Search | |
| 36 | MValid Sudoku | M | 1 | Hash Table | |
| 39 | MCombination Sum | M | 1 | Backtracking | |
| 40 | MCombination Sum II | M | 1 | Backtracking | |
| 42 | HTrapping Rain Water | H | 1 | Stack | Dynamic ProgrammingTwo Pointers |
| 44 | HWildcard Matching | H | 1 | DFSDynamic ProgrammingGreedy | |
| 45 | MJump Game II | M | 1 | Dynamic ProgrammingGreedy | |
| 46 | MPermutations★2 刷 | M | 2 | Backtracking | |
| 47 | MPermutations II | M | 1 | BacktrackingSorting | |
| 48 | MRotate Image2 刷 | M | 2 | Math | |
| 49 | MGroup Anagrams | M | 1 | StringHash Table | Sorting |
| 50 | MPow(x, n) | M | 1 | DFSMath | |
| 51 | HN-Queens | H | 1 | Backtracking | |
| 52 | HN-Queens II | H | 1 | Backtracking | |
| 53 | EMaximum Subarray3 刷 | E | 3 | Binary SearchDynamic Programming | |
| 54 | MSpiral Matrix | M | 1 | Math | |
| 55 | MJump Game | M | 1 | Dynamic ProgrammingGreedy | |
| 56 | MMerge Intervals2 刷 | M | 2 | Sorting | |
| 57 | MInsert Interval | M | 1 | Sorting | |
| 61 | MRotate List | M | 1 | Linked List | Two Pointers |
| 62 | MUnique Paths★ | M | 1 | BacktrackingDynamic ProgrammingMath | |
| 63 | MUnique Paths II | M | 1 | Dynamic Programming | |
| 70 | EClimbing Stairs2 刷 | E | 2 | Dynamic ProgrammingMath | |
| 73 | MSet Matrix Zeroes | M | 1 | Hash Table | |
| 74 | MSearch a 2D Matrix | M | 1 | Binary Search | |
| 75 | MSort Colors★ | M | 1 | Two PointersSorting | |
| 76 | HMinimum Window Substring | H | 1 | StringHash Table | Two Pointers |
| 77 | MCombinations | M | 1 | Backtracking | |
| 78 | MSubsets★3 刷 | M | 3 | BacktrackingMath | |
| 79 | MWord Search3 刷 | M | 3 | String | DFSBacktracking |
| 83 | ERemove Duplicates from Sorted List | E | 1 | Linked List | |
| 88 | EMerge Sorted Array2 刷 | E | 2 | Two PointersSorting | |
| 90 | MSubsets II★ | M | 1 | BacktrackingMath | |
| 91 | MDecode Ways | M | 1 | String | Dynamic Programming |
| 94 | EBinary Tree Inorder Traversal | E | 1 | StackTree | DFS |
| 98 | MValidate Binary Search Tree | M | 1 | Tree | DFS |
| 100 | ESame Tree | E | 1 | Tree | BFSDFS |
| 102 | MBinary Tree Level Order Traversal3 刷 | M | 3 | Tree | BFS |
| 103 | MBinary Tree Zigzag Level Order Traversal | M | 1 | Tree | BFS |
| 104 | EMaximum Depth of Binary Tree2 刷 | E | 2 | Tree | BFSDFS |
| 105 | MConstruct Binary Tree from Preorder and Inorder Traversal | M | 1 | Hash TableTree | Binary Search |
| 107 | MBinary Tree Level Order Traversal II | M | 1 | Tree | BFS |
| 110 | EBalanced Binary Tree | E | 1 | Tree | DFS |
| 112 | EPath Sum | E | 1 | Tree | BFSDFS |
| 113 | MPath Sum II | M | 1 | Tree | DFSBacktracking |
| 114 | MFlatten Binary Tree to Linked List | M | 1 | StackLinked ListTree | |
| 118 | EPascal's Triangle | E | 1 | Dynamic Programming | |
| 121 | EBest Time to Buy and Sell Stock3 刷 | E | 3 | Dynamic Programming | |
| 122 | MBest Time to Buy and Sell Stock II | M | 1 | Dynamic ProgrammingGreedy | |
| 125 | EValid Palindrome | E | 1 | String | Two Pointers |
| 126 | HWord Ladder II | H | 1 | String | BFSBacktracking |
| 127 | HWord Ladder | H | 1 | StringHash Table | BFS |
| 128 | MLongest Consecutive Sequence | M | 1 | Hash TableGraph | |
| 131 | MPalindrome Partitioning | M | 1 | String | BacktrackingDynamic Programming |
| 133 | MClone Graph★2 刷 | M | 2 | Graph | BFSDFS |
| 134 | MGas Station | M | 1 | Greedy | |
| 136 | ESingle Number | E | 1 | Math | |
| 137 | MSingle Number II | M | 1 | Math | |
| 139 | MWord Break | M | 1 | StringTree | Dynamic Programming |
| 140 | HWord Break II | H | 1 | Tree | BacktrackingDynamic Programming |
| 141 | ELinked List Cycle2 刷 | E | 2 | Linked ListHash Table | Two Pointers |
| 142 | MLinked List Cycle II | M | 1 | Linked ListHash Table | Two Pointers |
| 144 | EBinary Tree Preorder Traversal | E | 1 | StackTree | DFS |
| 145 | EBinary Tree Postorder Traversal | E | 1 | StackTree | DFS |
| 146 | MLRU Cache★2 刷 | M | 2 | Design Data StructureLinked ListHash Table | |
| 152 | MMaximum Product Subarray | M | 1 | Dynamic Programming | |
| 153 | MFind Minimum in Rotated Sorted Array3 刷 | M | 3 | Binary Search | |
| 155 | EMin Stack | E | 1 | StackDesign Data Structure | |
| 162 | MFind Peak Element | M | 1 | Binary Search | |
| 167 | MTwo Sum II - Input Array Is Sorted | M | 1 | Binary SearchTwo Pointers | |
| 173 | MBinary Search Tree Iterator★2 刷 | M | 2 | StackDesign Data StructureTree | |
| 189 | MRotate Array | M | 1 | Two PointersMath | |
| 191 | ENumber of 1 Bits | E | 1 | Binary SearchMath | |
| 198 | MHouse Robber | M | 1 | Dynamic Programming | |
| 200 | MNumber of Islands | M | 1 | Graph | BFSDFS |
| 202 | EHappy Number | E | 1 | Hash Table | Two PointersMath |
| 203 | ERemove Linked List Elements | E | 1 | Linked List | DFS |
| 205 | EIsomorphic Strings | E | 1 | StringHash Table | |
| 206 | EReverse Linked List2 刷 | E | 2 | Linked List | DFS |
| 207 | MCourse Schedule2 刷 | M | 2 | Graph | BFSDFS |
| 208 | MImplement Trie (Prefix Tree) | M | 1 | StringDesign Data StructureTree | |
| 210 | MCourse Schedule II | M | 1 | Graph | BFSDFS |
| 212 | HWord Search II | H | 1 | StringTree | Backtracking |
| 213 | MHouse Robber II | M | 1 | Dynamic Programming | |
| 215 | MKth Largest Element in an Array | M | 1 | Heap | Binary SearchSorting |
| 216 | MCombination Sum III | M | 1 | Backtracking | |
| 217 | EContains Duplicate3 刷 | E | 3 | Hash Table | Sorting |
| 221 | MMaximal Square | M | 1 | Dynamic Programming | |
| 222 | MCount Complete Tree Nodes | M | 1 | Tree | Binary SearchMath |
| 226 | EInvert Binary Tree | E | 1 | Tree | BFSDFS |
| 228 | ESummary Ranges | E | 1 | Two Pointers | |
| 230 | MKth Smallest Element in a BST | M | 1 | Tree | DFS |
| 232 | EImplement Queue using Stacks | E | 1 | StackQueueDesign Data Structure | |
| 234 | EPalindrome Linked List | E | 1 | StackLinked List | Two Pointers |
| 235 | ELowest Common Ancestor of a Binary Search Tree | E | 1 | Tree | DFS |
| 236 | MLowest Common Ancestor of a Binary Tree★2 刷 | M | 2 | Tree | DFS |
| 238 | MProduct of Array Except Self3 刷 | M | 3 | Hash Table | |
| 239 | HSliding Window Maximum | H | 1 | QueueHeap | Two Pointers |
| 242 | EValid Anagram | E | 1 | StringHash Table | Sorting |
| 257 | EBinary Tree Paths | E | 1 | Tree | DFSBacktracking |
| 263 | EUgly Number | E | 1 | Math | |
| 264 | MUgly Number II | M | 1 | Heap | Dynamic ProgrammingMath |
| 268 | EMissing Number | E | 1 | Binary SearchSortingMath | |
| 278 | EFirst Bad Version | E | 1 | Binary SearchMath | |
| 283 | EMove Zeroes | E | 1 | Two Pointers | |
| 290 | EWord Pattern | E | 1 | StringHash Table | |
| 300 | MLongest Increasing Subsequence | M | 1 | Binary SearchDynamic Programming | |
| 309 | MBest Time to Buy and Sell Stock with Cooldown | M | 1 | Dynamic Programming | |
| 322 | MCoin Change★ | M | 1 | BFSDynamic Programming | |
| 332 | HReconstruct Itinerary | H | 1 | HeapGraph | Sorting |
| 338 | ECounting Bits | E | 1 | Dynamic ProgrammingMath | |
| 347 | MTop K Frequent Elements | M | 1 | Heap | Binary SearchSorting |
| 349 | EIntersection of Two Arrays | E | 1 | Binary SearchTwo PointersSorting | |
| 350 | EIntersection of Two Arrays II3 刷 | E | 3 | Binary SearchTwo PointersSorting | |
| 377 | MCombination Sum IV | M | 1 | Dynamic Programming | |
| 383 | ERansom Note | E | 1 | StringHash Table | |
| 387 | EFirst Unique Character in a String | E | 1 | StringQueueHash Table | |
| 409 | ELongest Palindrome | E | 1 | StringHash Table | Greedy |
| 424 | MLongest Repeating Character Replacement★3 刷 | M | 3 | StringHash Table | Two Pointers |
| 435 | MNon-overlapping Intervals | M | 1 | Dynamic ProgrammingSortingGreedy | |
| 494 | MTarget Sum | M | 1 | BacktrackingDynamic Programming | |
| 496 | ENext Greater Element I | E | 1 | StackHash Table | |
| 503 | MNext Greater Element II | M | 1 | Stack | |
| 509 | EFibonacci Number | E | 1 | DFSDynamic ProgrammingMath | |
| 518 | MCoin Change 2 | M | 1 | Dynamic Programming | |
| 543 | EDiameter of Binary Tree2 刷 | E | 2 | Tree | DFS |
| 566 | EReshape the Matrix | E | 1 | Math | |
| 572 | ESubtree of Another Tree | E | 1 | StringTree | DFS |
| 621 | MTask Scheduler | M | 1 | Heap | SortingGreedy |
| 647 | MPalindromic Substrings | M | 1 | String | Dynamic ProgrammingTwo Pointers |
| 658 | MFind K Closest Elements | M | 1 | Heap | Binary SearchSorting |
| 674 | ELongest Continuous Increasing Subsequence | E | 1 | Dynamic Programming | |
| 678 | MValid Parenthesis String | M | 1 | Stack | Dynamic ProgrammingGreedy |
| 680 | EValid Palindrome II | E | 1 | String | Two PointersGreedy |
| 692 | MTop K Frequent Words | M | 1 | HeapTree | Sorting |
| 695 | MMax Area of Island | M | 1 | Graph | BFSDFS |
| 704 | EBinary Search2 刷 | E | 2 | Binary Search | |
| 739 | MDaily Temperatures4 刷 | M | 4 | Stack | |
| 746 | EMin Cost Climbing Stairs | E | 1 | Dynamic Programming | |
| 763 | MPartition Labels | M | 1 | String | Two PointersGreedy |
| 835 | MImage Overlap | M | 1 | Hash Table | |
| 836 | ERectangle Overlap | E | 1 | Math | |
| 846 | MHand of Straights | M | 1 | Hash Table | SortingGreedy |
| 852 | EPeak Index in a Mountain Array | E | 1 | Binary Search | |
| 856 | MScore of Parentheses | M | 1 | StringStack | |
| 867 | ETranspose Matrix | E | 1 | Math | |
| 876 | EMiddle of the Linked List | E | 1 | Linked List | Two Pointers |
| 921 | MMinimum Add to Make Parentheses Valid | M | 1 | StringStack | Greedy |
| 994 | MRotting Oranges2 刷 | M | 2 | BFS | |
| 1021 | ERemove Outermost Parentheses | E | 1 | StringStack | |
| 1091 | MShortest Path in Binary Matrix | M | 1 | BFS | |
| 1111 | MMaximum Nesting Depth of Two Valid Parentheses Strings | M | 1 | StringStack | |
| 1143 | MLongest Common Subsequence | M | 1 | String | Dynamic Programming |
| 1190 | MReverse Substrings Between Each Pair of Parentheses | M | 1 | StringStack | |
| 1401 | MCircle and Rectangle Overlapping | M | 1 | Math | |
| 1477 | MFind Two Non-overlapping Sub-arrays Each With Target Sum | M | 1 | Hash Table | Binary SearchTwo Pointers |
| 1520 | HMaximum Number of Non-Overlapping Substrings | H | 1 | Hash Table | SortingGreedy |
| 1541 | MMinimum Insertions to Balance a Parentheses String | M | 1 | StringStack | Greedy |
| 1614 | EMaximum Nesting Depth of the Parentheses | E | 1 | StringStack | |
| 1658 | MMinimum Operations to Reduce X to Zero | M | 1 | Hash Table | Binary SearchTwo Pointers |
| 1807 | MEvaluate the Bracket Pairs of a String | M | 1 | StringHash Table | |
| 2089 | EFind Target Indices After Sorting Array | E | 1 | Binary SearchSorting | |
| 2185 | ECounting Words With a Given Prefix | E | 1 | String | |
| 2186 | MMinimum Number of Steps to Make Two Strings Anagram II | M | 1 | StringHash Table | |
| 2243 | ECalculate Digit Sum of a String | E | 1 | String | Math |
| 2244 | MMinimum Rounds to Complete All Tasks | M | 1 | Hash Table | Greedy |
| 2248 | EIntersection of Multiple Arrays | E | 1 | Hash Table | Sorting |
| 2249 | MCount Lattice Points Inside a Circle | M | 1 | Hash Table | BacktrackingMath |
| 2259 | ERemove Digit From Number to Maximize Result | E | 1 | String | BacktrackingGreedy |
| 2260 | MMinimum Consecutive Cards to Pick Up | M | 1 | Hash Table | Two Pointers |
| 2261 | MK Divisible Elements Subarrays | M | 1 | StringTree | Backtracking |
| 2262 | HTotal Appeal of A String | H | 1 | StringHash Table | Dynamic Programming |
| 2264 | ELargest 3-Same-Digit Number in String | E | 1 | String | |
| 2266 | MCount Number of Texts | M | 1 | String | Dynamic ProgrammingMath |
| 2267 | HCheck if There Is a Valid Parentheses String Path2 刷 | H | 2 | Dynamic Programming | |
| 2273 | EFind Resultant Array After Removing Anagrams | E | 1 | StringHash Table | Sorting |
| 2274 | MMaximum Consecutive Floors Without Special Floors | M | 1 | Sorting | |
| 2472 | HMaximum Number of Non-overlapping Palindrome Substrings | H | 1 | Dynamic ProgrammingTwo PointersGreedy | |
| 2778 | ESum of Squares of Special Elements | E | 1 | Backtracking | |
| 2913 | ESubarrays Distinct Element Sum of Squares I | E | 1 | Hash Table | |
| 3498 | EReverse Degree of a String | E | 1 | String | Math |
| 3524 | MFind X Value of Array I | M | 1 | Dynamic ProgrammingMath | |
| 3550 | ESmallest Index With Digit Sum Equal to Index | E | 1 | Math | |
| 3723 | MMaximize Sum of Squares of Digits | M | 1 | GreedyMath | |
| 3727 | MMaximum Alternating Sum of Squares | M | 1 | SortingGreedy |