├── .github ├── FUNDING.yml └── workflows │ └── deploy.yml ├── .gitignore ├── .travis.yml ├── .vscode ├── launch.json └── settings.json ├── LICENSE ├── README.md ├── README_old.md ├── ctl ├── README.md ├── command.go ├── config.go ├── error.go ├── label.go ├── main.go ├── meta │ ├── Array │ ├── Backtracking │ ├── Binary_Indexed_Tree │ ├── Binary_Search │ ├── Bit_Manipulation │ ├── Breadth_First_Search │ ├── Depth_First_Search │ ├── Dynamic_Programming │ ├── Hash_Table │ ├── Linked_List │ ├── Math │ ├── PDFPreface │ ├── Segment_Tree │ ├── Sliding_Window │ ├── Sorting │ ├── Stack │ ├── String │ ├── Tree │ ├── Two_Pointers │ ├── Union_Find │ └── meta ├── models │ ├── go.mod │ ├── go.sum │ ├── lcproblems.go │ ├── mdrow.go │ ├── tagproblem.go │ └── user.go ├── pdf.go ├── rangking.go ├── refresh.go ├── render.go ├── request.go ├── statistic.go ├── template │ ├── Array.md │ ├── Backtracking.md │ ├── Binary_Indexed_Tree.md │ ├── Binary_Search.md │ ├── Bit_Manipulation.md │ ├── Breadth_First_Search.md │ ├── Depth_First_Search.md │ ├── Dynamic_Programming.md │ ├── Hash_Table.md │ ├── Linked_List.md │ ├── Math.md │ ├── Segment_Tree.md │ ├── Sliding_Window.md │ ├── Sorting.md │ ├── Stack.md │ ├── String.md │ ├── Tree.md │ ├── Two_Pointers.md │ ├── Union_Find.md │ ├── collapseSection.md │ ├── menu.md │ └── template.markdown ├── template_render.go ├── util │ ├── go.mod │ └── util.go └── version.go ├── go.mod ├── go.sum ├── gotest.sh ├── leetcode ├── 0001.Two-Sum │ ├── 1. Two Sum.go │ ├── 1. Two Sum_test.go │ └── README.md ├── 0002.Add-Two-Numbers │ ├── 2. Add Two Numbers.go │ ├── 2. Add Two Numbers_test.go │ └── README.md ├── 0003.Longest-Substring-Without-Repeating-Characters │ ├── 3. Longest Substring Without Repeating Characters.go │ ├── 3. Longest Substring Without Repeating Characters_test.go │ └── README.md ├── 0004.Median-of-Two-Sorted-Arrays │ ├── 4. Median of Two Sorted Arrays.go │ ├── 4. Median of Two Sorted Arrays_test.go │ └── README.md ├── 0005.Longest-Palindromic-Substring │ ├── 5. Longest Palindromic Substring.go │ ├── 5. Longest Palindromic Substring_test.go │ └── README.md ├── 0006.ZigZag-Conversion │ ├── 6. ZigZag Conversion.go │ ├── 6. ZigZag Conversion_test.go │ └── README.md ├── 0007.Reverse-Integer │ ├── 7. Reverse Integer.go │ ├── 7. Reverse Integer_test.go │ └── README.md ├── 0008.String-to-Integer-atoi │ ├── 8. String to Integer atoi.go │ ├── 8. String to Integer atoi_test.go │ └── README.md ├── 0009.Palindrome-Number │ ├── 9. Palindrome Number.go │ ├── 9. Palindrome Number_test.go │ └── README.md ├── 0011.Container-With-Most-Water │ ├── 11. Container With Most Water.go │ ├── 11. Container With Most Water_test.go │ └── README.md ├── 0012.Integer-to-Roman │ ├── 12. Integer to Roman.go │ ├── 12. Integer to Roman_test.go │ └── README.md ├── 0013.Roman-to-Integer │ ├── 13. Roman to Integer.go │ ├── 13. Roman to Integer_test.go │ └── README.md ├── 0014.Longest-Common-Prefix │ ├── 14.Longest Common Prefix.go │ ├── 14.Longest Common Prefix_test.go │ └── README.md ├── 0015.3Sum │ ├── 15. 3Sum.go │ ├── 15. 3Sum_test.go │ └── README.md ├── 0016.3Sum-Closest │ ├── 16. 3Sum Closest.go │ ├── 16. 3Sum Closest_test.go │ └── README.md ├── 0017.Letter-Combinations-of-a-Phone-Number │ ├── 17. Letter Combinations of a Phone Number.go │ ├── 17. Letter Combinations of a Phone Number_test.go │ └── README.md ├── 0018.4Sum │ ├── 18. 4Sum.go │ ├── 18. 4Sum_test.go │ └── README.md ├── 0019.Remove-Nth-Node-From-End-of-List │ ├── 19. Remove Nth Node From End of List.go │ ├── 19. Remove Nth Node From End of List_test.go │ └── README.md ├── 0020.Valid-Parentheses │ ├── 20. Valid Parentheses.go │ ├── 20. Valid Parentheses_test.go │ └── README.md ├── 0021.Merge-Two-Sorted-Lists │ ├── 21. Merge Two Sorted Lists.go │ ├── 21. Merge Two Sorted Lists_test.go │ └── README.md ├── 0022.Generate-Parentheses │ ├── 22. Generate Parentheses.go │ ├── 22. Generate Parentheses_test.go │ └── README.md ├── 0023.Merge-k-Sorted-Lists │ ├── 23. Merge k Sorted Lists.go │ ├── 23. Merge k Sorted Lists_test.go │ └── README.md ├── 0024.Swap-Nodes-in-Pairs │ ├── 24. Swap Nodes in Pairs.go │ ├── 24. Swap Nodes in Pairs_test.go │ └── README.md ├── 0025.Reverse-Nodes-in-k-Group │ ├── 25. Reverse Nodes in k Group.go │ ├── 25. Reverse Nodes in k Group_test.go │ └── README.md ├── 0026.Remove-Duplicates-from-Sorted-Array │ ├── 26. Remove Duplicates from Sorted Array.go │ ├── 26. Remove Duplicates from Sorted Array_test.go │ └── README.md ├── 0027.Remove-Element │ ├── 27. Remove Element.go │ ├── 27. Remove Element_test.go │ └── README.md ├── 0028.Find-the-Index-of-the-First-Occurrence-in-a-String │ ├── 28. Find the Index of the First Occurrence in a String.go │ ├── 28. Find the Index of the First Occurrence in a String_test.go │ └── README.md ├── 0029.Divide-Two-Integers │ ├── 29. Divide Two Integers.go │ ├── 29. Divide Two Integers_test.go │ └── README.md ├── 0030.Substring-with-Concatenation-of-All-Words │ ├── 30. Substring with Concatenation of All Words.go │ ├── 30. Substring with Concatenation of All Words_test.go │ └── README.md ├── 0031.Next-Permutation │ ├── 31. Next Permutation.go │ ├── 31. Next Permutation_test.go │ └── README.md ├── 0032.Longest-Valid-Parentheses │ ├── 32. Longest Valid Parentheses.go │ ├── 32. Longest Valid Parentheses_test.go │ └── README.md ├── 0033.Search-in-Rotated-Sorted-Array │ ├── 33. Search in Rotated Sorted Array.go │ ├── 33. Search in Rotated Sorted Array_test.go │ └── README.md ├── 0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array │ ├── 34. Find First and Last Position of Element in Sorted Array.go │ ├── 34. Find First and Last Position of Element in Sorted Array_test.go │ └── README.md ├── 0035.Search-Insert-Position │ ├── 35. Search Insert Position.go │ ├── 35. Search Insert Position_test.go │ └── README.md ├── 0036.Valid-Sudoku │ ├── 36. Valid Sudoku.go │ ├── 36. Valid Sudoku_test.go │ └── README.md ├── 0037.Sudoku-Solver │ ├── 37. Sudoku Solver.go │ ├── 37. Sudoku Solver_test.go │ └── README.md ├── 0039.Combination-Sum │ ├── 39. Combination Sum.go │ ├── 39. Combination Sum_test.go │ └── README.md ├── 0040.Combination-Sum-II │ ├── 40. Combination Sum II.go │ ├── 40. Combination Sum II_test.go │ └── README.md ├── 0041.First-Missing-Positive │ ├── 41. First Missing Positive.go │ ├── 41. First Missing Positive_test.go │ └── README.md ├── 0042.Trapping-Rain-Water │ ├── 42. Trapping Rain Water.go │ ├── 42. Trapping Rain Water_test.go │ └── README.md ├── 0043.Multiply-Strings │ ├── 43. Multiply Strings.go │ ├── 43. Multiply Strings_test.go │ └── README.md ├── 0045.Jump-Game-II │ ├── 45. Jump Game II.go │ ├── 45. Jump Game II_test.go │ └── README.md ├── 0046.Permutations │ ├── 46. Permutations.go │ ├── 46. Permutations_test.go │ └── README.md ├── 0047.Permutations-II │ ├── 47. Permutations II.go │ ├── 47. Permutations II_test.go │ └── README.md ├── 0048.Rotate-Image │ ├── 48. Rotate Image.go │ ├── 48. Rotate Image_test.go │ └── README.md ├── 0049.Group-Anagrams │ ├── 49. Group Anagrams.go │ ├── 49. Group Anagrams_test.go │ └── README.md ├── 0050.Powx-n │ ├── 50. Pow(x, n).go │ ├── 50. Pow(x, n)_test.go │ └── README.md ├── 0051.N-Queens │ ├── 51. N-Queens.go │ ├── 51. N-Queens_test.go │ └── README.md ├── 0052.N-Queens-II │ ├── 52. N-Queens II.go │ ├── 52. N-Queens II_test.go │ └── README.md ├── 0053.Maximum-Subarray │ ├── 53. Maximum Subarray.go │ ├── 53. Maximum Subarray_test.go │ └── README.md ├── 0054.Spiral-Matrix │ ├── 54. Spiral Matrix.go │ ├── 54. Spiral Matrix_test.go │ └── README.md ├── 0055.Jump-Game │ ├── 55. Jump Game.go │ ├── 55. Jump Game_test.go │ └── README.md ├── 0056.Merge-Intervals │ ├── 56. Merge Intervals.go │ ├── 56. Merge Intervals_test.go │ └── README.md ├── 0057.Insert-Interval │ ├── 57. Insert Interval.go │ ├── 57. Insert Interval_test.go │ └── README.md ├── 0058.Length-of-Last-Word │ ├── 58.Length of Last Word.go │ ├── 58.Length of Last Word_test.go │ └── README.md ├── 0059.Spiral-Matrix-II │ ├── 59. Spiral Matrix II.go │ ├── 59. Spiral Matrix II_test.go │ └── README.md ├── 0060.Permutation-Sequence │ ├── 60. Permutation Sequence.go │ ├── 60. Permutation Sequence_test.go │ └── README.md ├── 0061.Rotate-List │ ├── 61. Rotate List.go │ ├── 61. Rotate List_test.go │ └── README.md ├── 0062.Unique-Paths │ ├── 62. Unique Paths.go │ ├── 62. Unique Paths_test.go │ └── README.md ├── 0063.Unique-Paths-II │ ├── 63. Unique Paths II.go │ ├── 63. Unique Paths II_test.go │ └── README.md ├── 0064.Minimum-Path-Sum │ ├── 64. Minimum Path Sum.go │ ├── 64. Minimum Path Sum_test.go │ └── README.md ├── 0065.Valid-Number │ ├── 65. Valid Number.go │ ├── 65. Valid Number_test.go │ └── README.md ├── 0066.Plus-One │ ├── 66. Plus One.go │ ├── 66. Plus One_test.go │ └── README.md ├── 0067.Add-Binary │ ├── 67. Add Binary.go │ ├── 67. Add Binary_test.go │ └── README.md ├── 0069.Sqrtx │ ├── 69. Sqrt(x).go │ ├── 69. Sqrt(x)_test.go │ └── README.md ├── 0070.Climbing-Stairs │ ├── 70. Climbing Stairs.go │ ├── 70. Climbing Stairs_test.go │ └── README.md ├── 0071.Simplify-Path │ ├── 71. Simplify Path.go │ ├── 71. Simplify Path_test.go │ └── README.md ├── 0073.Set-Matrix-Zeroes │ ├── 73. Set Matrix Zeroes.go │ ├── 73. Set Matrix Zeroes_test.go │ └── README.md ├── 0074.Search-a-2D-Matrix │ ├── 74. Search a 2D Matrix.go │ ├── 74. Search a 2D Matrix_test.go │ └── README.md ├── 0075.Sort-Colors │ ├── 75. Sort Colors.go │ ├── 75. Sort Colors_test.go │ └── README.md ├── 0076.Minimum-Window-Substring │ ├── 76. Minimum Window Substring.go │ ├── 76. Minimum Window Substring_test.go │ └── README.md ├── 0077.Combinations │ ├── 77. Combinations.go │ ├── 77. Combinations_test.go │ └── README.md ├── 0078.Subsets │ ├── 78. Subsets.go │ ├── 78. Subsets_test.go │ └── README.md ├── 0079.Word-Search │ ├── 79. Word Search.go │ ├── 79. Word Search_test.go │ └── README.md ├── 0080.Remove-Duplicates-from-Sorted-Array-II │ ├── 80. Remove Duplicates from Sorted Array II.go │ ├── 80. Remove Duplicates from Sorted Array II_test.go │ └── README.md ├── 0081.Search-in-Rotated-Sorted-Array-II │ ├── 81. Search in Rotated Sorted Array II.go │ ├── 81. Search in Rotated Sorted Array II_test.go │ └── README.md ├── 0082.Remove-Duplicates-from-Sorted-List-II │ ├── 82. Remove Duplicates from Sorted List II.go │ ├── 82. Remove Duplicates from Sorted List II_test.go │ └── README.md ├── 0083.Remove-Duplicates-from-Sorted-List │ ├── 83. Remove Duplicates from Sorted List.go │ ├── 83. Remove Duplicates from Sorted List_test.go │ └── README.md ├── 0084.Largest-Rectangle-in-Histogram │ ├── 84. Largest Rectangle in Histogram.go │ ├── 84. Largest Rectangle in Histogram_test.go │ └── README.md ├── 0086.Partition-List │ ├── 86. Partition List.go │ ├── 86. Partition List_test.go │ └── README.md ├── 0088.Merge-Sorted-Array │ ├── 88. Merge Sorted Array.go │ ├── 88. Merge Sorted Array_test.go │ └── README.md ├── 0089.Gray-Code │ ├── 89. Gray Code.go │ ├── 89. Gray Code_test.go │ └── README.md ├── 0090.Subsets-II │ ├── 90. Subsets II.go │ ├── 90. Subsets II_test.go │ └── README.md ├── 0091.Decode-Ways │ ├── 91. Decode Ways.go │ ├── 91. Decode Ways_test.go │ └── README.md ├── 0092.Reverse-Linked-List-II │ ├── 92. Reverse Linked List II.go │ ├── 92. Reverse Linked List II_test.go │ └── README.md ├── 0093.Restore-IP-Addresses │ ├── 93. Restore IP Addresses.go │ ├── 93. Restore IP Addresses_test.go │ └── README.md ├── 0094.Binary-Tree-Inorder-Traversal │ ├── 94. Binary Tree Inorder Traversal.go │ ├── 94. Binary Tree Inorder Traversal_test.go │ └── README.md ├── 0095.Unique-Binary-Search-Trees-II │ ├── 95. Unique Binary Search Trees II.go │ ├── 95. Unique Binary Search Trees II_test.go │ └── README.md ├── 0096.Unique-Binary-Search-Trees │ ├── 96. Unique Binary Search Trees.go │ ├── 96. Unique Binary Search Trees_test.go │ └── README.md ├── 0097.Interleaving-String │ ├── 97. Interleaving String.go │ ├── 97. Interleaving String_test.go │ └── README.md ├── 0098.Validate-Binary-Search-Tree │ ├── 98. Validate Binary Search Tree.go │ ├── 98. Validate Binary Search Tree_test.go │ └── README.md ├── 0099.Recover-Binary-Search-Tree │ ├── 99. Recover Binary Search Tree.go │ ├── 99. Recover Binary Search Tree_test.go │ └── README.md ├── 0100.Same-Tree │ ├── 100. Same Tree.go │ ├── 100. Same Tree_test.go │ └── README.md ├── 0101.Symmetric-Tree │ ├── 101. Symmetric Tree.go │ ├── 101. Symmetric Tree_test.go │ └── README.md ├── 0102.Binary-Tree-Level-Order-Traversal │ ├── 102. Binary Tree Level Order Traversal.go │ ├── 102. Binary Tree Level Order Traversal_test.go │ └── README.md ├── 0103.Binary-Tree-Zigzag-Level-Order-Traversal │ ├── 103. Binary Tree Zigzag Level Order Traversal.go │ ├── 103. Binary Tree Zigzag Level Order Traversal_test.go │ └── README.md ├── 0104.Maximum-Depth-of-Binary-Tree │ ├── 104. Maximum Depth of Binary Tree.go │ ├── 104. Maximum Depth of Binary Tree_test.go │ └── README.md ├── 0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal │ ├── 105. Construct Binary Tree from Preorder and Inorder Traversal.go │ ├── 105. Construct Binary Tree from Preorder and Inorder Traversal_test.go │ └── README.md ├── 0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal │ ├── 106. Construct Binary Tree from Inorder and Postorder Traversal.go │ ├── 106. Construct Binary Tree from Inorder and Postorder Traversal_test.go │ └── README.md ├── 0107.Binary-Tree-Level-Order-Traversal-II │ ├── 107. Binary Tree Level Order Traversal II.go │ ├── 107. Binary Tree Level Order Traversal II_test.go │ └── README.md ├── 0108.Convert-Sorted-Array-to-Binary-Search-Tree │ ├── 108. Convert Sorted Array to Binary Search Tree.go │ ├── 108. Convert Sorted Array to Binary Search Tree_test.go │ └── README.md ├── 0109.Convert-Sorted-List-to-Binary-Search-Tree │ ├── 109. Convert Sorted List to Binary Search Tree.go │ ├── 109. Convert Sorted List to Binary Search Tree_test.go │ └── README.md ├── 0110.Balanced-Binary-Tree │ ├── 110. Balanced Binary Tree.go │ ├── 110. Balanced Binary Tree_test.go │ └── README.md ├── 0111.Minimum-Depth-of-Binary-Tree │ ├── 111. Minimum Depth of Binary Tree.go │ ├── 111. Minimum Depth of Binary Tree_test.go │ └── README.md ├── 0112.Path-Sum │ ├── 112. Path Sum.go │ ├── 112. Path Sum_test.go │ └── README.md ├── 0113.Path-Sum-II │ ├── 113. Path Sum II.go │ ├── 113. Path Sum II_test.go │ └── README.md ├── 0114.Flatten-Binary-Tree-to-Linked-List │ ├── 114. Flatten Binary Tree to Linked List.go │ ├── 114. Flatten Binary Tree to Linked List_test.go │ └── README.md ├── 0115.Distinct-Subsequences │ ├── 115. Distinct Subsequences.go │ ├── 115. Distinct Subsequences_test.go │ └── README.md ├── 0116.Populating-Next-Right-Pointers-in-Each-Node │ ├── 116.Populating Next Right Pointers in Each Node.go │ ├── 116.Populating Next Right Pointers in Each Node_test.go │ └── README.md ├── 0118.Pascals-Triangle │ ├── 118. Pascals Triangle.go │ ├── 118. Pascals Triangle_test.go │ └── README.md ├── 0119.Pascals-Triangle-II │ ├── 119. Pascals Triangle II.go │ ├── 119. Pascals Triangle II_test.go │ └── README.md ├── 0120.Triangle │ ├── 120. Triangle.go │ ├── 120. Triangle_test.go │ └── README.md ├── 0121.Best-Time-to-Buy-and-Sell-Stock │ ├── 121. Best Time to Buy and Sell Stock.go │ ├── 121. Best Time to Buy and Sell Stock_test.go │ └── README.md ├── 0122.Best-Time-to-Buy-and-Sell-Stock-II │ ├── 122. Best Time to Buy and Sell Stock II.go │ ├── 122. Best Time to Buy and Sell Stock II_test.go │ └── README.md ├── 0124.Binary-Tree-Maximum-Path-Sum │ ├── 124. Binary Tree Maximum Path Sum.go │ ├── 124. Binary Tree Maximum Path Sum_test.go │ └── README.md ├── 0125.Valid-Palindrome │ ├── 125. Valid Palindrome.go │ ├── 125. Valid Palindrome_test.go │ └── README.md ├── 0126.Word-Ladder-II │ ├── 126. Word Ladder II.go │ ├── 126. Word Ladder II_test.go │ └── README.md ├── 0127.Word-Ladder │ ├── 127. Word Ladder.go │ ├── 127. Word Ladder_test.go │ └── README.md ├── 0128.Longest-Consecutive-Sequence │ ├── 128. Longest Consecutive Sequence.go │ ├── 128. Longest Consecutive Sequence_test.go │ └── README.md ├── 0129.Sum-Root-to-Leaf-Numbers │ ├── 129. Sum Root to Leaf Numbers.go │ ├── 129. Sum Root to Leaf Numbers_test.go │ └── README.md ├── 0130.Surrounded-Regions │ ├── 130. Surrounded Regions.go │ ├── 130. Surrounded Regions_test.go │ └── README.md ├── 0131.Palindrome-Partitioning │ ├── 131. Palindrome Partitioning.go │ ├── 131. Palindrome Partitioning_test.go │ └── README.md ├── 0134.Gas-Station │ ├── Gas.go │ ├── Gas_test.go │ └── README.md ├── 0135.Candy │ ├── 135. Candy.go │ ├── 135. Candy_test.go │ └── README.md ├── 0136.Single-Number │ ├── 136. Single Number.go │ ├── 136. Single Number_test.go │ └── README.md ├── 0137.Single-Number-II │ ├── 137. Single Number II.go │ ├── 137. Single Number II_test.go │ └── README.md ├── 0138.Copy-List-With-Random-Pointer │ ├── 138. Copy List With Random Pointer.go │ ├── 138. Copy List With Random Pointer_test.go │ └── README.md ├── 0141.Linked-List-Cycle │ ├── 141. Linked List Cycle.go │ ├── 141. Linked List Cycle_test.go │ └── README.md ├── 0142.Linked-List-Cycle-II │ ├── 142. Linked List Cycle II.go │ ├── 142. Linked List Cycle II_test.go │ └── README.md ├── 0143.Reorder-List │ ├── 143. Reorder List.go │ ├── 143. Reorder List_test.go │ └── README.md ├── 0144.Binary-Tree-Preorder-Traversal │ ├── 144. Binary Tree Preorder Traversal.go │ ├── 144. Binary Tree Preorder Traversal_test.go │ └── README.md ├── 0145.Binary-Tree-Postorder-Traversal │ ├── 145. Binary Tree Postorder Traversal.go │ ├── 145. Binary Tree Postorder Traversal_test.go │ └── README.md ├── 0146.LRU-Cache │ ├── 146. LRU Cache.go │ ├── 146. LRU Cache_test.go │ └── README.md ├── 0147.Insertion-Sort-List │ ├── 147. Insertion Sort List.go │ ├── 147. Insertion Sort List_test.go │ └── README.md ├── 0148.Sort-List │ ├── 148. Sort List.go │ ├── 148. Sort List_test.go │ └── README.md ├── 0150.Evaluate-Reverse-Polish-Notation │ ├── 150. Evaluate Reverse Polish Notation.go │ ├── 150. Evaluate Reverse Polish Notation_test.go │ └── README.md ├── 0151.Reverse-Words-in-a-String │ ├── 151. Reverse Words in a String.go │ ├── 151. Reverse Words in a String_test.go │ └── README.md ├── 0152.Maximum-Product-Subarray │ ├── 152. Maximum Product Subarray.go │ ├── 152. Maximum Product Subarray_test.go │ └── README.md ├── 0153.Find-Minimum-in-Rotated-Sorted-Array │ ├── 153. Find Minimum in Rotated Sorted Array.go │ ├── 153. Find Minimum in Rotated Sorted Array_test.go │ └── README.md ├── 0154.Find-Minimum-in-Rotated-Sorted-Array-II │ ├── 154. Find Minimum in Rotated Sorted Array II.go │ ├── 154. Find Minimum in Rotated Sorted Array II_test.go │ └── README.md ├── 0155.Min-Stack │ ├── 155. Min Stack.go │ ├── 155. Min Stack_test.go │ └── README.md ├── 0160.Intersection-of-Two-Linked-Lists │ ├── 160. Intersection of Two Linked Lists.go │ ├── 160. Intersection of Two Linked Lists_test.go │ └── README.md ├── 0162.Find-Peak-Element │ ├── 162. Find Peak Element.go │ ├── 162. Find Peak Element_test.go │ └── README.md ├── 0164.Maximum-Gap │ ├── 164. Maximum Gap.go │ ├── 164. Maximum Gap_test.go │ └── README.md ├── 0167.Two-Sum-II-Input-array-is-sorted │ ├── 167. Two Sum II - Input array is sorted.go │ ├── 167. Two Sum II - Input array is sorted_test.go │ └── README.md ├── 0168.Excel-Sheet-Column-Title │ ├── 168. Excel Sheet Column Title.go │ ├── 168. Excel Sheet Column Title_test.go │ └── README.md ├── 0169.Majority-Element │ ├── 169. Majority Element.go │ ├── 169. Majority Element_test.go │ └── README.md ├── 0171.Excel-Sheet-Column-Number │ ├── 171. Excel Sheet Column Number.go │ ├── 171. Excel Sheet Column Number_test.go │ └── README.md ├── 0172.Factorial-Trailing-Zeroes │ ├── 172. Factorial Trailing Zeroes.go │ ├── 172. Factorial Trailing Zeroes_test.go │ └── README.md ├── 0173.Binary-Search-Tree-Iterator │ ├── 173. Binary Search Tree Iterator.go │ ├── 173. Binary Search Tree Iterator_test.go │ └── README.md ├── 0174.Dungeon-Game │ ├── 174. Dungeon Game.go │ ├── 174. Dungeon Game_test.go │ └── README.md ├── 0179.Largest-Number │ ├── 179. Largest Number.go │ ├── 179. Largest Number_test.go │ └── README.md ├── 0187.Repeated-DNA-Sequences │ ├── 187. Repeated DNA Sequences.go │ ├── 187. Repeated DNA Sequences_test.go │ └── README.md ├── 0189.Rotate-Array │ ├── 189. Rotate Array.go │ ├── 189. Rotate Array_test.go │ └── README.md ├── 0190.Reverse-Bits │ ├── 190. Reverse Bits.go │ ├── 190. Reverse Bits_test.go │ └── README.md ├── 0191.Number-of-1-Bits │ ├── 191. Number of 1 Bits.go │ ├── 191. Number of 1 Bits_test.go │ └── README.md ├── 0198.House-Robber │ ├── 198. House Robber.go │ ├── 198. House Robber_test.go │ └── README.md ├── 0199.Binary-Tree-Right-Side-View │ ├── 199. Binary Tree Right Side View.go │ ├── 199. Binary Tree Right Side View_test.go │ └── README.md ├── 0200.Number-of-Islands │ ├── 200. Number of Islands.go │ ├── 200. Number of Islands_test.go │ └── README.md ├── 0201.Bitwise-AND-of-Numbers-Range │ ├── 201. Bitwise AND of Numbers Range.go │ ├── 201. Bitwise AND of Numbers Range_test.go │ └── README.md ├── 0202.Happy-Number │ ├── 202. Happy Number.go │ ├── 202. Happy Number_test.go │ └── README.md ├── 0203.Remove-Linked-List-Elements │ ├── 203. Remove Linked List Elements.go │ ├── 203. Remove Linked List Elements_test.go │ └── README.md ├── 0204.Count-Primes │ ├── 204. Count Primes.go │ ├── 204. Count Primes_test.go │ └── README.md ├── 0205.Isomorphic-Strings │ ├── 205. Isomorphic Strings.go │ ├── 205. Isomorphic Strings_test.go │ └── README.md ├── 0206.Reverse-Linked-List │ ├── 206. Reverse Linked List.go │ ├── 206. Reverse Linked List_test.go │ └── README.md ├── 0207.Course-Schedule │ ├── 207. Course Schedule.go │ ├── 207. Course Schedule_test.go │ └── README.md ├── 0208.Implement-Trie-Prefix-Tree │ ├── 208. Implement Trie (Prefix Tree).go │ ├── 208. Implement Trie (Prefix Tree)_test.go │ └── README.md ├── 0209.Minimum-Size-Subarray-Sum │ ├── 209. Minimum Size Subarray Sum.go │ ├── 209. Minimum Size Subarray Sum_test.go │ └── README.md ├── 0210.Course-Schedule-II │ ├── 210. Course Schedule II.go │ ├── 210. Course Schedule II_test.go │ └── README.md ├── 0211.Design-Add-and-Search-Words-Data-Structure │ ├── 211. Design Add and Search Words Data Structure.go │ ├── 211. Design Add and Search Words Data Structure_test.go │ └── README.md ├── 0212.Word-Search-II │ ├── 212. Word Search II.go │ ├── 212. Word Search II_test.go │ └── README.md ├── 0213.House-Robber-II │ ├── 213. House Robber II.go │ ├── 213. House Robber II_test.go │ └── README.md ├── 0215.Kth-Largest-Element-in-an-Array │ ├── 215. Kth Largest Element in an Array.go │ ├── 215. Kth Largest Element in an Array_test.go │ └── README.md ├── 0216.Combination-Sum-III │ ├── 216. Combination Sum III.go │ ├── 216. Combination Sum III_test.go │ └── README.md ├── 0217.Contains-Duplicate │ ├── 217. Contains Duplicate.go │ ├── 217. Contains Duplicate_test.go │ └── README.md ├── 0218.The-Skyline-Problem │ ├── 218. The Skyline Problem.go │ ├── 218. The Skyline Problem_test.go │ └── README.md ├── 0219.Contains-Duplicate-II │ ├── 219. Contains Duplicate II.go │ ├── 219. Contains Duplicate II_test.go │ └── README.md ├── 0220.Contains-Duplicate-III │ ├── 220. Contains Duplicate III.go │ ├── 220. Contains Duplicate III_test.go │ └── README.md ├── 0222.Count-Complete-Tree-Nodes │ ├── 222. Count Complete Tree Nodes.go │ ├── 222. Count Complete Tree Nodes_test.go │ └── README.md ├── 0223.Rectangle-Area │ ├── 223. Rectangle Area.go │ ├── 223. Rectangle Area_test.go │ └── README.md ├── 0224.Basic-Calculator │ ├── 224. Basic Calculator.go │ ├── 224. Basic Calculator_test.go │ └── README.md ├── 0225.Implement-Stack-using-Queues │ ├── 225. Implement Stack using Queues.go │ ├── 225. Implement Stack using Queues_test.go │ └── README.md ├── 0226.Invert-Binary-Tree │ ├── 226. Invert Binary Tree.go │ ├── 226. Invert Binary Tree_test.go │ └── README.md ├── 0227.Basic-Calculator-II │ ├── 227. Basic Calculator II.go │ ├── 227. Basic Calculator II_test.go │ └── README.md ├── 0228.Summary-Ranges │ ├── 228. Summary Ranges.go │ ├── 228. Summary Ranges_test.go │ └── README.md ├── 0229.Majority-Element-II │ ├── 229. Majority Element II.go │ ├── 229. Majority Element II_test.go │ └── README.md ├── 0230.Kth-Smallest-Element-in-a-BST │ ├── 230. Kth Smallest Element in a BST.go │ ├── 230. Kth Smallest Element in a BST_test.go │ └── README.md ├── 0231.Power-of-Two │ ├── 231. Power of Two.go │ ├── 231. Power of Two_test.go │ └── README.md ├── 0232.Implement-Queue-using-Stacks │ ├── 232. Implement Queue using Stacks.go │ ├── 232. Implement Queue using Stacks_test.go │ └── README.md ├── 0234.Palindrome-Linked-List │ ├── 234. Palindrome Linked List.go │ ├── 234. Palindrome Linked List_test.go │ └── README.md ├── 0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree │ ├── 235. Lowest Common Ancestor of a Binary Search Tree.go │ ├── 235. Lowest Common Ancestor of a Binary Search Tree_test.go │ └── README.md ├── 0236.Lowest-Common-Ancestor-of-a-Binary-Tree │ ├── 236. Lowest Common Ancestor of a Binary Tree.go │ ├── 236. Lowest Common Ancestor of a Binary Tree_test.go │ └── README.md ├── 0237.Delete-Node-in-a-Linked-List │ ├── 237. Delete Node in a Linked List.go │ ├── 237. Delete Node in a Linked List_test.go │ └── README.md ├── 0239.Sliding-Window-Maximum │ ├── 239. Sliding Window Maximum.go │ ├── 239. Sliding Window Maximum_test.go │ └── README.md ├── 0240.Search-a-2D-Matrix-II │ ├── 240. Search a 2D Matrix II.go │ ├── 240. Search a 2D Matrix II_test.go │ └── README.md ├── 0242.Valid-Anagram │ ├── 242. Valid Anagram.go │ ├── 242. Valid Anagram_test.go │ └── README.md ├── 0257.Binary-Tree-Paths │ ├── 257. Binary Tree Paths.go │ ├── 257. Binary Tree Paths_test.go │ └── README.md ├── 0258.Add-Digits │ ├── 258. Add Digits.go │ ├── 258. Add Digits_test.go │ └── README.md ├── 0260.Single-Number-III │ ├── 260. Single Number III.go │ ├── 260. Single Number III_test.go │ └── README.md ├── 0263.Ugly-Number │ ├── 263. Ugly Number.go │ ├── 263. Ugly Number_test.go │ └── README.md ├── 0264.Ugly-Number-II │ ├── 264. Ugly Number II.go │ ├── 264. Ugly Number II_test.go │ └── README.md ├── 0268.Missing-Number │ ├── 268. Missing Number.go │ ├── 268. Missing Number_test.go │ └── README.md ├── 0274.H-Index │ ├── 274. H-Index.go │ ├── 274. H-Index_test.go │ └── README.md ├── 0275.H-Index-II │ ├── 275. H-Index II.go │ ├── 275. H-Index II_test.go │ └── README.md ├── 0278.First-Bad-Version │ ├── 278. First Bad Version.go │ ├── 278. First Bad Version_test.go │ └── README.md ├── 0279.Perfect-Squares │ ├── 279. Perfect Squares.go │ ├── 279. Perfect Squares_test.go │ └── README.md ├── 0283.Move-Zeroes │ ├── 283. Move Zeroes.go │ ├── 283. Move Zeroes_test.go │ └── README.md ├── 0284.Peeking-Iterator │ ├── 284. Peeking Iterator.go │ ├── 284. Peeking Iterator_test.go │ └── README.md ├── 0287.Find-the-Duplicate-Number │ ├── 287. Find the Duplicate Number.go │ ├── 287. Find the Duplicate Number_test.go │ └── README.md ├── 0290.Word-Pattern │ ├── 290. Word Pattern.go │ ├── 290. Word Pattern_test.go │ └── README.md ├── 0297.Serialize-and-Deserialize-Binary-Tree │ ├── 297.Serialize and Deserialize Binary Tree.go │ ├── 297.Serialize and Deserialize Binary Tree_test.go │ └── README.md ├── 0299.Bulls-and-Cows │ ├── 299.Bulls and Cows.go │ ├── 299.Bulls and Cows_test.go │ └── README.md ├── 0300.Longest-Increasing-Subsequence │ ├── 300. Longest Increasing Subsequence.go │ ├── 300. Longest Increasing Subsequence_test.go │ └── README.md ├── 0301.Remove-Invalid-Parentheses │ ├── 301.Remove Invalid Parentheses.go │ ├── 301.Remove Invalid Parentheses_test.go │ └── README.md ├── 0303.Range-Sum-Query-Immutable │ ├── 303. Range Sum Query - Immutable.go │ ├── 303. Range Sum Query - Immutable_test.go │ └── README.md ├── 0304.Range-Sum-Query-2D-Immutable │ ├── 304. Range Sum Query 2D - Immutable.go │ ├── 304. Range Sum Query 2D - Immutable_test.go │ └── README.md ├── 0306.Additive-Number │ ├── 306. Additive Number.go │ ├── 306. Additive Number_test.go │ └── README.md ├── 0307.Range-Sum-Query-Mutable │ ├── 307. Range Sum Query - Mutable.go │ ├── 307. Range Sum Query - Mutable_test.go │ └── README.md ├── 0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown │ ├── 309. Best Time to Buy and Sell Stock with Cooldown.go │ ├── 309. Best Time to Buy and Sell Stock with Cooldown_test.go │ └── README.md ├── 0315.Count-of-Smaller-Numbers-After-Self │ ├── 315. Count of Smaller Numbers After Self.go │ ├── 315. Count of Smaller Numbers After Self_test.go │ └── README.md ├── 0318.Maximum-Product-of-Word-Lengths │ ├── 318. Maximum Product of Word Lengths.go │ ├── 318. Maximum Product of Word Lengths_test.go │ └── README.md ├── 0319.Bulb-Switcher │ ├── 319.Bulb Switcher.go │ ├── 319.Bulb Switcher_test.go │ └── README.md ├── 0322.Coin-Change │ ├── 322. Coin Change.go │ ├── 322. Coin Change_test.go │ └── README.md ├── 0324.Wiggle-Sort-II │ ├── 324. Wiggle Sort II.go │ ├── 324. Wiggle Sort II_test.go │ └── README.md ├── 0326.Power-of-Three │ ├── 326. Power of Three.go │ ├── 326. Power of Three_test.go │ └── README.md ├── 0327.Count-of-Range-Sum │ ├── 327. Count of Range Sum.go │ ├── 327. Count of Range Sum_test.go │ └── README.md ├── 0328.Odd-Even-Linked-List │ ├── 328. Odd Even Linked List.go │ ├── 328. Odd Even Linked List_test.go │ └── README.md ├── 0329.Longest-Increasing-Path-in-a-Matrix │ ├── 329. Longest Increasing Path in a Matrix.go │ ├── 329. Longest Increasing Path in a Matrix_test.go │ └── README.md ├── 0331.Verify-Preorder-Serialization-of-a-Binary-Tree │ ├── 331. Verify Preorder Serialization of a Binary Tree.go │ ├── 331. Verify Preorder Serialization of a Binary Tree_test.go │ └── README.md ├── 0337.House-Robber-III │ ├── 337. House Robber III.go │ ├── 337. House Robber III_test.go │ └── README.md ├── 0338.Counting-Bits │ ├── 338. Counting Bits.go │ ├── 338. Counting Bits_test.go │ └── README.md ├── 0341.Flatten-Nested-List-Iterator │ ├── 341. Flatten Nested List Iterator.go │ ├── 341. Flatten Nested List Iterator_test.go │ └── README.md ├── 0342.Power-of-Four │ ├── 342. Power of Four.go │ ├── 342. Power of Four_test.go │ └── README.md ├── 0343.Integer-Break │ ├── 343. Integer Break.go │ ├── 343. Integer Break_test.go │ └── README.md ├── 0344.Reverse-String │ ├── 344. Reverse String.go │ ├── 344. Reverse String_test.go │ └── README.md ├── 0345.Reverse-Vowels-of-a-String │ ├── 345. Reverse Vowels of a String.go │ ├── 345. Reverse Vowels of a String_test.go │ └── README.md ├── 0347.Top-K-Frequent-Elements │ ├── 347. Top K Frequent Elements.go │ ├── 347. Top K Frequent Elements_test.go │ └── README.md ├── 0349.Intersection-of-Two-Arrays │ ├── 349. Intersection of Two Arrays.go │ ├── 349. Intersection of Two Arrays_test.go │ └── README.md ├── 0350.Intersection-of-Two-Arrays-II │ ├── 350. Intersection of Two Arrays II.go │ ├── 350. Intersection of Two Arrays II_test.go │ └── README.md ├── 0352.Data-Stream-as-Disjoint-Intervals │ ├── 352.Data Stream as Disjoint Intervals.go │ ├── 352.Data Stream as Disjoint Intervals_test.go │ └── README.md ├── 0354.Russian-Doll-Envelopes │ ├── 354. Russian Doll Envelopes.go │ ├── 354. Russian Doll Envelopes_test.go │ └── README.md ├── 0357.Count-Numbers-with-Unique-Digits │ ├── 357. Count Numbers with Unique Digits.go │ ├── 357. Count Numbers with Unique Digits_test.go │ └── README.md ├── 0367.Valid-Perfect-Square │ ├── 367. Valid Perfect Square.go │ ├── 367. Valid Perfect Square_test.go │ └── README.md ├── 0368.Largest-Divisible-Subset │ ├── 368. Largest Divisible Subset.go │ ├── 368. Largest Divisible Subset_test.go │ └── README.md ├── 0371.Sum-of-Two-Integers │ ├── 371. Sum of Two Integers.go │ ├── 371. Sum of Two Integers_test.go │ └── README.md ├── 0372.Super-Pow │ ├── 372. Super Pow.go │ ├── 372. Super Pow_test.go │ └── README.md ├── 0373.Find-K-Pairs-with-Smallest-Sums │ ├── 373. Find K Pairs with Smallest Sums.go │ ├── 373. Find K Pairs with Smallest Sums_test.go │ └── README.md ├── 0374.Guess-Number-Higher-or-Lower │ ├── 374. Guess Number Higher or Lower.go │ ├── 374. Guess Number Higher or Lower_test.go │ └── README.md ├── 0376.Wiggle-Subsequence │ ├── 376. Wiggle Subsequence.go │ ├── 376. Wiggle Subsequence_test.go │ └── README.md ├── 0377.Combination-Sum-IV │ ├── 377. Combination Sum IV.go │ ├── 377. Combination Sum IV_test.go │ └── README.md ├── 0378.Kth-Smallest-Element-in-a-Sorted-Matrix │ ├── 378. Kth Smallest Element in a Sorted Matrix.go │ ├── 378. Kth Smallest Element in a Sorted Matrix_test.go │ └── README.md ├── 0382.Linked-List-Random-Node │ ├── 382. Linked List Random Node.go │ ├── 382. Linked List Random Node_test.go │ └── README.md ├── 0383.Ransom-Note │ ├── 383.Ransom Note.go │ ├── 383.Ransom Note_test.go │ └── README.md ├── 0384.Shuffle-an-Array │ ├── 384.Shuffle an Array.go │ ├── 384.Shuffle an Array_test.go │ └── README.md ├── 0385.Mini-Parser │ ├── 385. Mini Parser.go │ ├── 385. Mini Parser_test.go │ └── README.md ├── 0386.Lexicographical-Numbers │ ├── 386. Lexicographical Numbers.go │ ├── 386. Lexicographical Numbers_test.go │ └── README.md ├── 0387.First-Unique-Character-in-a-String │ ├── 387. First Unique Character in a String.go │ ├── 387. First Unique Character in a String_test.go │ └── README.md ├── 0389.Find-the-Difference │ ├── 389. Find the Difference.go │ ├── 389. Find the Difference_test.go │ └── README.md ├── 0390.Elimination-Game │ ├── 390. Elimination Game.go │ ├── 390. Elimination Game_test.go │ └── README.md ├── 0391.Perfect-Rectangle │ ├── 391.Perfect Rectangle.go │ ├── 391.Perfect Rectangle_test.go │ └── README.md ├── 0392.Is-Subsequence │ ├── 392. Is Subsequence.go │ ├── 392. Is Subsequence_test.go │ └── README.md ├── 0393.UTF-8-Validation │ ├── 393. UTF-8 Validation.go │ ├── 393. UTF-8 Validation_test.go │ └── README.md ├── 0394.Decode-String │ ├── 394. Decode String.go │ ├── 394. Decode String_test.go │ └── README.md ├── 0395.Longest-Substring-with-At-Least-K-Repeating-Characters │ ├── 395. Longest Substring with At Least K Repeating Characters.go │ ├── 395. Longest Substring with At Least K Repeating Characters_test.go │ └── README.md ├── 0396.Rotate-Function │ ├── 396. Rotate Function.go │ ├── 396. Rotate Function_test.go │ └── README.md ├── 0397.Integer-Replacement │ ├── 397. Integer Replacement.go │ ├── 397. Integer Replacement_test.go │ └── README.md ├── 0399.Evaluate-Division │ ├── 399. Evaluate Division.go │ ├── 399. Evaluate Division_test.go │ └── README.md ├── 0400.Nth-Digit │ ├── 400.Nth Digit.go │ ├── 400.Nth Digit_test.go │ └── README.md ├── 0401.Binary-Watch │ ├── 401. Binary Watch.go │ ├── 401. Binary Watch_test.go │ └── README.md ├── 0402.Remove-K-Digits │ ├── 402. Remove K Digits.go │ ├── 402. Remove K Digits_test.go │ └── README.md ├── 0404.Sum-of-Left-Leaves │ ├── 404. Sum of Left Leaves.go │ ├── 404. Sum of Left Leaves_test.go │ └── README.md ├── 0405.Convert-a-Number-to-Hexadecimal │ ├── 405. Convert a Number to Hexadecimal.go │ ├── 405. Convert a Number to Hexadecimal_test.go │ └── README.md ├── 0409.Longest-Palindrome │ ├── 409. Longest Palindrome.go │ ├── 409. Longest Palindrome_test.go │ └── README.md ├── 0410.Split-Array-Largest-Sum │ ├── 410. Split Array Largest Sum.go │ ├── 410. Split Array Largest Sum_test.go │ └── README.md ├── 0412.Fizz-Buzz │ ├── 412. Fizz Buzz.go │ ├── 412. Fizz Buzz_test.go │ └── README.md ├── 0413.Arithmetic-Slices │ ├── 413. Arithmetic Slices.go │ ├── 413. Arithmetic Slices_test.go │ └── README.md ├── 0414.Third-Maximum-Number │ ├── 414. Third Maximum Number.go │ ├── 414. Third Maximum Number_test.go │ └── README.md ├── 0416.Partition-Equal-Subset-Sum │ ├── 416. Partition Equal Subset Sum.go │ ├── 416. Partition Equal Subset Sum_test.go │ └── README.md ├── 0417.Pacific-Atlantic-Water-Flow │ ├── 417. Pacific Atlantic Water Flow.go │ ├── 417. Pacific Atlantic Water Flow_test.go │ └── README.md ├── 0419.Battleships-in-a-Board │ ├── 419. Battleships in a Board.go │ ├── 419. Battleships in a Board_test.go │ └── README.md ├── 0421.Maximum-XOR-of-Two-Numbers-in-an-Array │ ├── 421. Maximum XOR of Two Numbers in an Array.go │ ├── 421. Maximum XOR of Two Numbers in an Array_test.go │ └── README.md ├── 0423.Reconstruct-Original-Digits-from-English │ ├── 423. Reconstruct Original Digits from English.go │ ├── 423. Reconstruct Original Digits from English_test.go │ └── README.md ├── 0424.Longest-Repeating-Character-Replacement │ ├── 424. Longest Repeating Character Replacement.go │ ├── 424. Longest Repeating Character Replacement_test.go │ └── README.md ├── 0429.N-ary-Tree-Level-Order-Traversal │ ├── 429. N-ary Tree Level Order Traversal.go │ ├── 429. N-ary Tree Level Order Traversal_test.go │ └── README.md ├── 0433.Minimum-Genetic-Mutation │ ├── 433. Minimum Genetic Mutation.go │ ├── 433. Minimum Genetic Mutation_test.go │ └── README.md ├── 0434.Number-of-Segments-in-a-String │ ├── 434.Number of Segments in a String.go │ ├── 434.Number of Segments in a String_test.go │ └── README.md ├── 0435.Non-overlapping-Intervals │ ├── 435. Non-overlapping Intervals.go │ ├── 435. Non-overlapping Intervals_test.go │ └── README.md ├── 0436.Find-Right-Interval │ ├── 436. Find Right Interval.go │ ├── 436. Find Right Interval_test.go │ └── README.md ├── 0437.Path-Sum-III │ ├── 437. Path Sum III.go │ ├── 437. Path Sum III_test.go │ └── README.md ├── 0438.Find-All-Anagrams-in-a-String │ ├── 438. Find All Anagrams in a String.go │ ├── 438. Find All Anagrams in a String_test.go │ └── README.md ├── 0441.Arranging-Coins │ ├── 441. Arranging Coins.go │ ├── 441. Arranging Coins_test.go │ └── README.md ├── 0445.Add-Two-Numbers-II │ ├── 445. Add Two Numbers II.go │ ├── 445. Add Two Numbers II_test.go │ └── README.md ├── 0447.Number-of-Boomerangs │ ├── 447. Number of Boomerangs.go │ ├── 447. Number of Boomerangs_test.go │ └── README.md ├── 0448.Find-All-Numbers-Disappeared-in-an-Array │ ├── 448. Find All Numbers Disappeared in an Array.go │ ├── 448. Find All Numbers Disappeared in an Array_test.go │ └── README.md ├── 0451.Sort-Characters-By-Frequency │ ├── 451. Sort Characters By Frequency.go │ ├── 451. Sort Characters By Frequency_test.go │ └── README.md ├── 0453.Minimum-Moves-to-Equal-Array-Elements │ ├── 453. Minimum Moves to Equal Array Elements.go │ ├── 453. Minimum Moves to Equal Array Elements_test.go │ └── README.md ├── 0454.4Sum-II │ ├── 454. 4Sum II.go │ ├── 454. 4Sum II_test.go │ └── README.md ├── 0455.Assign-Cookies │ ├── 455. Assign Cookies.go │ ├── 455. Assign Cookies_test.go │ └── README.md ├── 0456.132-Pattern │ ├── 456. 132 Pattern.go │ ├── 456. 132 Pattern_test.go │ └── README.md ├── 0457.Circular-Array-Loop │ ├── 457. Circular Array Loop.go │ ├── 457. Circular Array Loop_test.go │ └── README.md ├── 0458.Poor-Pigs │ ├── 458.Poor Pigs.go │ ├── 458.Poor Pigs_test.go │ └── README.md ├── 0460.LFU-Cache │ ├── 460. LFU Cache.go │ ├── 460. LFU Cache_test.go │ └── README.md ├── 0461.Hamming-Distance │ ├── 461. Hamming Distance.go │ ├── 461. Hamming Distance_test.go │ └── README.md ├── 0462.Minimum-Moves-to-Equal-Array-Elements-II │ ├── 462. Minimum Moves to Equal Array Elements II.go │ ├── 462. Minimum Moves to Equal Array Elements II_test.go │ └── README.md ├── 0463.Island-Perimeter │ ├── 463. Island Perimeter.go │ ├── 463. Island Perimeter_test.go │ └── README.md ├── 0470.Implement-Rand10-Using-Rand7 │ ├── 470. Implement Rand10() Using Rand7().go │ ├── 470. Implement Rand10() Using Rand7()_test.go │ └── README.md ├── 0473.Matchsticks-to-Square │ ├── 473. Matchsticks to Square.go │ ├── 473. Matchsticks to Square_test.go │ └── README.md ├── 0474.Ones-and-Zeroes │ ├── 474. Ones and Zeroes.go │ ├── 474. Ones and Zeroes_test.go │ └── README.md ├── 0475.Heaters │ ├── 475. Heaters.go │ ├── 475. Heaters_test.go │ └── README.md ├── 0476.Number-Complement │ ├── 476. Number Complement.go │ ├── 476. Number Complement_test.go │ └── README.md ├── 0477.Total-Hamming-Distance │ ├── 477. Total Hamming Distance.go │ ├── 477. Total Hamming Distance_test.go │ └── README.md ├── 0478.Generate-Random-Point-in-a-Circle │ ├── 478. Generate Random Point in a Circle.go │ ├── 478. Generate Random Point in a Circle_test.go │ └── README.md ├── 0480.Sliding-Window-Median │ ├── 480. Sliding Window Median.go │ ├── 480. Sliding Window Median_test.go │ └── README.md ├── 0483.Smallest-Good-Base │ ├── 483. Smallest Good Base.go │ ├── 483. Smallest Good Base_test.go │ └── README.md ├── 0485.Max-Consecutive-Ones │ ├── 485. Max Consecutive Ones.go │ ├── 485. Max Consecutive Ones_test.go │ └── README.md ├── 0488.Zuma-Game │ ├── 488.Zuma Game.go │ ├── 488.Zuma Game_test.go │ └── README.md ├── 0491.Non-decreasing-Subsequences │ ├── 491. Non-decreasing Subsequences.go │ ├── 491. Non-decreasing Subsequences_test.go │ └── README.md ├── 0492.Construct-the-Rectangle │ ├── 492.Construct the Rectangle.go │ ├── 492.Construct the Rectangle_test.go │ └── README.md ├── 0493.Reverse-Pairs │ ├── 493. Reverse Pairs.go │ ├── 493. Reverse Pairs_test.go │ └── README.md ├── 0494.Target-Sum │ ├── 494. Target Sum.go │ ├── 494. Target Sum_test.go │ └── README.md ├── 0495.Teemo-Attacking │ ├── 495.Teemo Attacking.go │ ├── 495.Teemo Attacking_test.go │ └── README.md ├── 0496.Next-Greater-Element-I │ ├── 496. Next Greater Element I.go │ ├── 496. Next Greater Element I_test.go │ └── README.md ├── 0497.Random-Point-in-Non-overlapping-Rectangles │ ├── 497. Random Point in Non-overlapping Rectangles.go │ ├── 497. Random Point in Non-overlapping Rectangles_test.go │ └── README.md ├── 0498.Diagonal-Traverse │ ├── 498. Diagonal Traverse.go │ ├── 498. Diagonal Traverse_test.go │ └── README.md ├── 0500.Keyboard-Row │ ├── 500. Keyboard Row.go │ ├── 500. Keyboard Row_test.go │ └── README.md ├── 0503.Next-Greater-Element-II │ ├── 503. Next Greater Element II.go │ ├── 503. Next Greater Element II_test.go │ └── README.md ├── 0504.Base-7 │ ├── 504.Base 7.go │ ├── 504.Base 7_test.go │ └── README.md ├── 0506.Relative-Ranks │ ├── 506.Relative Ranks.go │ ├── 506.Relative Ranks_test.go │ └── README.md ├── 0507.Perfect-Number │ ├── 507. Perfect Number.go │ ├── 507. Perfect Number_test.go │ └── README.md ├── 0508.Most-Frequent-Subtree-Sum │ ├── 508. Most Frequent Subtree Sum.go │ ├── 508. Most Frequent Subtree Sum_test.go │ └── README.md ├── 0509.Fibonacci-Number │ ├── 509. Fibonacci Number.go │ ├── 509. Fibonacci Number_test.go │ └── README.md ├── 0513.Find-Bottom-Left-Tree-Value │ ├── 513. Find Bottom Left Tree Value.go │ ├── 513. Find Bottom Left Tree Value_test.go │ └── README.md ├── 0515.Find-Largest-Value-in-Each-Tree-Row │ ├── 515. Find Largest Value in Each Tree Row.go │ ├── 515. Find Largest Value in Each Tree Row_test.go │ └── README.md ├── 0518.Coin-Change-II │ ├── 518. Coin Change II.go │ ├── 518. Coin Change II_test.go │ └── README.md ├── 0519.Random-Flip-Matrix │ ├── 519.Random Flip Matrix.go │ ├── 519.Random Flip Matrix_test.go │ └── README.md ├── 0520.Detect-Capital │ ├── 520.Detect Capital.go │ ├── 520.Detect Capital_test.go │ └── README.md ├── 0523.Continuous-Subarray-Sum │ ├── 523. Continuous Subarray Sum.go │ ├── 523. Continuous Subarray Sum_test.go │ └── README.md ├── 0524.Longest-Word-in-Dictionary-through-Deleting │ ├── 524. Longest Word in Dictionary through Deleting.go │ ├── 524. Longest Word in Dictionary through Deleting_test.go │ └── README.md ├── 0525.Contiguous-Array │ ├── 525. Contiguous Array.go │ ├── 525. Contiguous Array_test.go │ └── README.md ├── 0526.Beautiful-Arrangement │ ├── 526. Beautiful Arrangement.go │ ├── 526. Beautiful Arrangement_test.go │ └── README.md ├── 0528.Random-Pick-with-Weight │ ├── 528. Random Pick with Weight.go │ ├── 528. Random Pick with Weight_test.go │ └── README.md ├── 0529.Minesweeper │ ├── 529. Minesweeper.go │ ├── 529. Minesweeper_test.go │ └── README.md ├── 0530.Minimum-Absolute-Difference-in-BST │ ├── 530. Minimum Absolute Difference in BST.go │ ├── 530. Minimum Absolute Difference in BST_test.go │ └── README.md ├── 0532.K-diff-Pairs-in-an-Array │ ├── 532. K-diff Pairs in an Array.go │ ├── 532. K-diff Pairs in an Array_test.go │ └── README.md ├── 0535.Encode-and-Decode-TinyURL │ ├── 535. Encode and Decode TinyURL.go │ ├── 535. Encode and Decode TinyURL_test.go │ └── README.md ├── 0537.Complex-Number-Multiplication │ ├── 537. Complex Number Multiplication.go │ ├── 537. Complex Number Multiplication_test.go │ └── README.md ├── 0538.Convert-BST-to-Greater-Tree │ ├── 538. Convert BST to Greater Tree.go │ ├── 538. Convert BST to Greater Tree_test.go │ └── README.md ├── 0540.Single-Element-in-a-Sorted-Array │ ├── 540.Single Element in a Sorted Array.go │ ├── 540.Single Element in a Sorted Array_test.go │ └── README.md ├── 0541.Reverse-String-II │ ├── 541. Reverse String II.go │ ├── 541. Reverse String II_test.go │ └── README.md ├── 0542.01-Matrix │ ├── 542. 01 Matrix.go │ ├── 542. 01 Matrix_test.go │ └── README.md ├── 0543.Diameter-of-Binary-Tree │ ├── 543. Diameter of Binary Tree.go │ ├── 543. Diameter of Binary Tree_test.go │ └── README.md ├── 0547.Number-of-Provinces │ ├── 547. Number of Provinces.go │ ├── 547. Number of Provinces_test.go │ └── README.md ├── 0551.Student-Attendance-Record-I │ ├── 551.Student Attendance Record I.go │ ├── 551.Student Attendance Record I_test.go │ └── README.md ├── 0554.Brick-Wall │ ├── 554. Brick Wall.go │ ├── 554. Brick Wall_test.go │ └── README.md ├── 0557.Reverse-Words-in-a-String-III │ ├── 557. Reverse Words in a String III.go │ ├── 557. Reverse Words in a String III_test.go │ └── README.md ├── 0559.Maximum-Depth-of-N-ary-Tree │ ├── 559.Maximum Depth of N-ary Tree.go │ ├── 559.Maximum Depth of N-ary Tree_test.go │ └── README.md ├── 0560.Subarray-Sum-Equals-K │ ├── 560. Subarray Sum Equals K.go │ ├── 560. Subarray Sum Equals K_test.go │ └── README.md ├── 0561.Array-Partition │ ├── 561. Array Partition.go │ ├── 561. Array Partition_test.go │ └── README.md ├── 0563.Binary-Tree-Tilt │ ├── 563. Binary Tree Tilt.go │ ├── 563. Binary Tree Tilt_test.go │ └── README.md ├── 0566.Reshape-the-Matrix │ ├── 566. Reshape the Matrix.go │ ├── 566. Reshape the Matrix_test.go │ └── README.md ├── 0567.Permutation-in-String │ ├── 567. Permutation in String.go │ ├── 567. Permutation in String_test.go │ └── README.md ├── 0572.Subtree-of-Another-Tree │ ├── 572. Subtree of Another Tree.go │ ├── 572. Subtree of Another Tree_test.go │ └── README.md ├── 0575.Distribute-Candies │ ├── 575. Distribute Candies.go │ ├── 575. Distribute Candies_test.go │ └── README.md ├── 0576.Out-of-Boundary-Paths │ ├── 576. Out of Boundary Paths.go │ ├── 576. Out of Boundary Paths_test.go │ └── README.md ├── 0581.Shortest-Unsorted-Continuous-Subarray │ ├── 581. Shortest Unsorted Continuous Subarray.go │ ├── 581. Shortest Unsorted Continuous Subarray_test.go │ └── README.md ├── 0583.Delete-Operation-for-Two-Strings │ ├── 583. Delete Operation for Two Strings.go │ ├── 583. Delete Operation for Two Strings_test.go │ └── README.md ├── 0589.N-ary-Tree-Preorder-Traversal │ ├── 589. N-ary Tree Preorder Traversal.go │ ├── 589. N-ary Tree Preorder Traversal_test.go │ └── README.md ├── 0594.Longest-Harmonious-Subsequence │ ├── 594. Longest Harmonious Subsequence.go │ ├── 594. Longest Harmonious Subsequence_test.go │ └── README.md ├── 0598.Range-Addition-II │ ├── 598. Range Addition II.go │ ├── 598. Range Addition II_test.go │ └── README.md ├── 0599.Minimum-Index-Sum-of-Two-Lists │ ├── 599. Minimum Index Sum of Two Lists.go │ ├── 599. Minimum Index Sum of Two Lists_test.go │ └── README.md ├── 0605.Can-Place-Flowers │ ├── 605. Can Place Flowers.go │ ├── 605. Can Place Flowers_test.go │ └── README.md ├── 0609.Find-Duplicate-File-in-System │ ├── 609. Find Duplicate File in System.go │ ├── 609. Find Duplicate File in System_test.go │ └── README.md ├── 0611.Valid-Triangle-Number │ ├── 611. Valid Triangle Number.go │ ├── 611. Valid Triangle Number_test.go │ └── README.md ├── 0617.Merge-Two-Binary-Trees │ ├── 617. Merge Two Binary Trees.go │ ├── 617. Merge Two Binary Trees_test.go │ └── README.md ├── 0622.Design-Circular-Queue │ ├── 622. Design Circular Queue.go │ ├── 622. Design Circular Queue_test.go │ └── README.md ├── 0623.Add-One-Row-to-Tree │ ├── 623. Add One Row to Tree.go │ ├── 623. Add One Row to Tree_test.go │ └── README.md ├── 0628.Maximum-Product-of-Three-Numbers │ ├── 628. Maximum Product of Three Numbers.go │ ├── 628. Maximum Product of Three Numbers_test.go │ └── README.md ├── 0630.Course-Schedule-III │ ├── 630. Course Schedule III.go │ ├── 630. Course Schedule III_test.go │ └── README.md ├── 0632.Smallest-Range-Covering-Elements-from-K-Lists │ ├── 632. Smallest Range Covering Elements from K Lists.go │ ├── 632. Smallest Range Covering Elements from K Lists_test.go │ └── README.md ├── 0633.Sum-of-Square-Numbers │ ├── 633. Sum of Square Numbers.go │ ├── 633. Sum of Square Numbers_test.go │ └── README.md ├── 0636.Exclusive-Time-of-Functions │ ├── 636. Exclusive Time of Functions.go │ ├── 636. Exclusive Time of Functions_test.go │ └── README.md ├── 0637.Average-of-Levels-in-Binary-Tree │ ├── 637. Average of Levels in Binary Tree.go │ ├── 637. Average of Levels in Binary Tree_test.go │ └── README.md ├── 0638.Shopping-Offers │ ├── 638. Shopping Offers.go │ ├── 638. Shopping Offers_test.go │ └── README.md ├── 0643.Maximum-Average-Subarray-I │ ├── 643. Maximum Average Subarray I.go │ ├── 643. Maximum Average Subarray I_test.go │ └── README.md ├── 0645.Set-Mismatch │ ├── 645. Set Mismatch.go │ ├── 645. Set Mismatch_test.go │ └── README.md ├── 0647.Palindromic-Substrings │ ├── 647. Palindromic Substrings.go │ ├── 647. Palindromic Substrings_test.go │ └── README.md ├── 0648.Replace-Words │ ├── 648. Replace Words.go │ ├── 648. Replace Words_test.go │ └── README.md ├── 0653.Two-Sum-IV-Input-is-a-BST │ ├── 653. Two Sum IV - Input is a BST.go │ ├── 653. Two Sum IV - Input is a BST_test.go │ └── README.md ├── 0658.Find-K-Closest-Elements │ ├── 658. Find K Closest Elements.go │ ├── 658. Find K Closest Elements_test.go │ └── README.md ├── 0661.Image-Smoother │ ├── 661. Image Smoother.go │ ├── 661. Image Smoother_test.go │ └── README.md ├── 0662.Maximum-Width-of-Binary-Tree │ ├── 662. Maximum Width of Binary Tree.go │ ├── 662. Maximum Width of Binary Tree_test.go │ └── README.md ├── 0665.Non-decreasing-Array │ ├── 665. Non-decreasing Array.go │ ├── 665. Non-decreasing Array_test.go │ └── README.md ├── 0667.Beautiful-Arrangement-II │ ├── 667. Beautiful Arrangement II.go │ ├── 667. Beautiful Arrangement II_test.go │ └── README.md ├── 0668.Kth-Smallest-Number-in-Multiplication-Table │ ├── 668. Kth Smallest Number in Multiplication Table.go │ ├── 668. Kth Smallest Number in Multiplication Table_test.go │ └── README.md ├── 0669.Trim-a-Binary-Search-Tree │ ├── 669. Trim a Binary Search Tree.go │ ├── 669. Trim a Binary Search Tree_test.go │ └── README.md ├── 0674.Longest-Continuous-Increasing-Subsequence │ ├── 674. Longest Continuous Increasing Subsequence.go │ ├── 674. Longest Continuous Increasing Subsequence_test.go │ └── README.md ├── 0676.Implement-Magic-Dictionary │ ├── 676. Implement Magic Dictionary.go │ ├── 676. Implement Magic Dictionary_test.go │ └── README.md ├── 0677.Map-Sum-Pairs │ ├── 677. Map Sum Pairs.go │ ├── 677. Map Sum Pairs_test.go │ └── README.md ├── 0682.Baseball-Game │ ├── 682. Baseball Game.go │ ├── 682. Baseball Game_test.go │ └── README.md ├── 0684.Redundant-Connection │ ├── 684. Redundant Connection.go │ ├── 684. Redundant Connection_test.go │ └── README.md ├── 0685.Redundant-Connection-II │ ├── 685. Redundant Connection II.go │ ├── 685. Redundant Connection II_test.go │ └── README.md ├── 0690.Employee-Importance │ ├── 690. Employee Importance.go │ ├── 690. Employee Importance_test.go │ └── README.md ├── 0692.Top-K-Frequent-Words │ ├── 692. Top K Frequent Words.go │ ├── 692. Top K Frequent Words_test.go │ └── README.md ├── 0693.Binary-Number-with-Alternating-Bits │ ├── 693. Binary Number with Alternating Bits.go │ ├── 693. Binary Number with Alternating Bits_test.go │ └── README.md ├── 0695.Max-Area-of-Island │ ├── 695. Max Area of Island.go │ ├── 695. Max Area of Island_test.go │ └── README.md ├── 0696.Count-Binary-Substrings │ ├── 696. Count Binary Substrings.go │ ├── 696. Count Binary Substrings_test.go │ └── README.md ├── 0697.Degree-of-an-Array │ ├── 697. Degree of an Array.go │ ├── 697. Degree of an Array_test.go │ └── README.md ├── 0699.Falling-Squares │ ├── 699. Falling Squares.go │ ├── 699. Falling Squares_test.go │ └── README.md ├── 0700.Search-in-a-Binary-Search-Tree │ ├── 700.Search in a Binary Search Tree.go │ ├── 700.Search in a Binary Search Tree_test.go │ └── README.md ├── 0701.Insert-into-a-Binary-Search-Tree │ ├── 701. Insert into a Binary Search Tree.go │ ├── 701. Insert into a Binary Search Tree_test.go │ └── README.md ├── 0703.Kth-Largest-Element-in-a-Stream │ ├── 703. Kth Largest Element in a Stream.go │ ├── 703. Kth Largest Element in a Stream_test.go │ └── README.md ├── 0704.Binary-Search │ ├── 704. Binary Search.go │ ├── 704. Binary Search_test.go │ └── README.md ├── 0705.Design-HashSet │ ├── 705. Design HashSet.go │ ├── 705. Design HashSet_test.go │ └── README.md ├── 0706.Design-HashMap │ ├── 706. Design HashMap.go │ ├── 706. Design HashMap_test.go │ └── README.md ├── 0707.Design-Linked-List │ ├── 707. Design Linked List.go │ ├── 707. Design Linked List_test.go │ └── README.md ├── 0709.To-Lower-Case │ ├── 709. To Lower Case.go │ ├── 709. To Lower Case_test.go │ └── README.md ├── 0710.Random-Pick-with-Blacklist │ ├── 710. Random Pick with Blacklist.go │ ├── 710. Random Pick with Blacklist_test.go │ └── README.md ├── 0713.Subarray-Product-Less-Than-K │ ├── 713. Subarray Product Less Than K.go │ ├── 713. Subarray Product Less Than K_test.go │ └── README.md ├── 0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee │ ├── 714. Best Time to Buy and Sell Stock with Transaction Fee.go │ ├── 714. Best Time to Buy and Sell Stock with Transaction Fee_test.go │ └── README.md ├── 0715.Range-Module │ ├── 715. Range Module.go │ ├── 715. Range Module_test.go │ └── README.md ├── 0717.1-bit-and-2-bit-Characters │ ├── 717. 1-bit and 2-bit Characters.go │ ├── 717. 1-bit and 2-bit Characters_test.go │ └── README.md ├── 0718.Maximum-Length-of-Repeated-Subarray │ ├── 718. Maximum Length of Repeated Subarray.go │ ├── 718. Maximum Length of Repeated Subarray_test.go │ └── README.md ├── 0719.Find-K-th-Smallest-Pair-Distance │ ├── 719. Find K-th Smallest Pair Distance.go │ ├── 719. Find K-th Smallest Pair Distance_test.go │ └── README.md ├── 0720.Longest-Word-in-Dictionary │ ├── 720. Longest Word in Dictionary.go │ ├── 720. Longest Word in Dictionary_test.go │ └── README.md ├── 0721.Accounts-Merge │ ├── 721. Accounts Merge.go │ ├── 721. Accounts Merge_test.go │ └── README.md ├── 0724.Find-Pivot-Index │ ├── 724. Find Pivot Index.go │ ├── 724. Find Pivot Index_test.go │ └── README.md ├── 0725.Split-Linked-List-in-Parts │ ├── 725. Split Linked List in Parts.go │ ├── 725. Split Linked List in Parts_test.go │ └── README.md ├── 0726.Number-of-Atoms │ ├── 726. Number of Atoms.go │ ├── 726. Number of Atoms_test.go │ └── README.md ├── 0728.Self-Dividing-Numbers │ ├── 728.Self Dividing Numbers.go │ ├── 728.Self Dividing Numbers_test.go │ └── README.md ├── 0729.My-Calendar-I │ ├── 729. My Calendar I.go │ ├── 729. My Calendar I_test.go │ └── README.md ├── 0732.My-Calendar-III │ ├── 732. My Calendar III.go │ ├── 732. My Calendar III_test.go │ └── README.md ├── 0733.Flood-Fill │ ├── 733. Flood Fill.go │ ├── 733. Flood Fill_test.go │ └── README.md ├── 0735.Asteroid-Collision │ ├── 735. Asteroid Collision.go │ ├── 735. Asteroid Collision_test.go │ └── README.md ├── 0739.Daily-Temperatures │ ├── 739. Daily Temperatures.go │ ├── 739. Daily Temperatures_test.go │ └── README.md ├── 0744.Find-Smallest-Letter-Greater-Than-Target │ ├── 744. Find Smallest Letter Greater Than Target.go │ ├── 744. Find Smallest Letter Greater Than Target_test.go │ └── README.md ├── 0745.Prefix-and-Suffix-Search │ ├── 745. Prefix and Suffix Search.go │ ├── 745. Prefix and Suffix Search_test.go │ └── README.md ├── 0746.Min-Cost-Climbing-Stairs │ ├── 746. Min Cost Climbing Stairs.go │ ├── 746. Min Cost Climbing Stairs_test.go │ └── README.md ├── 0747.Largest-Number-At-Least-Twice-of-Others │ ├── 747. Largest Number At Least Twice of Others.go │ ├── 747. Largest Number At Least Twice of Others_test.go │ └── README.md ├── 0748.Shortest-Completing-Word │ ├── 748. Shortest Completing Word.go │ ├── 748. Shortest Completing Word_test.go │ └── README.md ├── 0752.Open-the-Lock │ ├── 752. Open the Lock.go │ ├── 752. Open the Lock_test.go │ └── README.md ├── 0753.Cracking-the-Safe │ ├── 753. Cracking the Safe.go │ ├── 753. Cracking the Safe_test.go │ └── README.md ├── 0756.Pyramid-Transition-Matrix │ ├── 756. Pyramid Transition Matrix.go │ ├── 756. Pyramid Transition Matrix_test.go │ └── README.md ├── 0762.Prime-Number-of-Set-Bits-in-Binary-Representation │ ├── 762. Prime Number of Set Bits in Binary Representation.go │ ├── 762. Prime Number of Set Bits in Binary Representation_test.go │ └── README.md ├── 0763.Partition-Labels │ ├── 763. Partition Labels.go │ ├── 763. Partition Labels_test.go │ └── README.md ├── 0765.Couples-Holding-Hands │ ├── 765. Couples Holding Hands.go │ ├── 765. Couples Holding Hands_test.go │ └── README.md ├── 0766.Toeplitz-Matrix │ ├── 766. Toeplitz Matrix.go │ ├── 766. Toeplitz Matrix_test.go │ └── README.md ├── 0767.Reorganize-String │ ├── 767. Reorganize String.go │ ├── 767. Reorganize String_test.go │ └── README.md ├── 0771.Jewels-and-Stones │ ├── 771. Jewels and Stones.go │ ├── 771. Jewels and Stones_test.go │ └── README.md ├── 0775.Global-and-Local-Inversions │ ├── 775. Global and Local Inversions.go │ ├── 775. Global and Local Inversions_test.go │ └── README.md ├── 0778.Swim-in-Rising-Water │ ├── 778. Swim in Rising Water.go │ ├── 778. Swim in Rising Water_test.go │ └── README.md ├── 0781.Rabbits-in-Forest │ ├── 781. Rabbits in Forest.go │ ├── 781. Rabbits in Forest_test.go │ └── README.md ├── 0783.Minimum-Distance-Between-BST-Nodes │ ├── 783. Minimum Distance Between BST Nodes.go │ ├── 783. Minimum Distance Between BST Nodes_test.go │ └── README.md ├── 0784.Letter-Case-Permutation │ ├── 784. Letter Case Permutation.go │ ├── 784. Letter Case Permutation_test.go │ └── README.md ├── 0785.Is-Graph-Bipartite │ ├── 785. Is Graph Bipartite.go │ ├── 785. Is Graph Bipartite_test.go │ └── README.md ├── 0786.K-th-Smallest-Prime-Fraction │ ├── 786. K-th Smallest Prime Fraction.go │ ├── 786. K-th Smallest Prime Fraction_test.go │ └── README.md ├── 0791.Custom-Sort-String │ ├── 791. Custom Sort String.go │ ├── 791. Custom Sort String_test.go │ └── README.md ├── 0792.Number-of-Matching-Subsequences │ ├── 792. Number of Matching Subsequences.go │ ├── 792. Number of Matching Subsequences_test.go │ └── README.md ├── 0793.Preimage-Size-of-Factorial-Zeroes-Function │ ├── 793. Preimage Size of Factorial Zeroes Function.go │ ├── 793. Preimage Size of Factorial Zeroes Function_test.go │ └── README.md ├── 0794.Valid-Tic-Tac-Toe-State │ ├── 794.Valid Tic-Tac-Toe State.go │ ├── 794.Valid Tic-Tac-Toe State_test.go │ └── README.md ├── 0795.Number-of-Subarrays-with-Bounded-Maximum │ ├── 795. Number of Subarrays with Bounded Maximum.go │ ├── 795. Number of Subarrays with Bounded Maximum_test.go │ └── README.md ├── 0802.Find-Eventual-Safe-States │ ├── 802. Find Eventual Safe States.go │ ├── 802. Find Eventual Safe States_test.go │ └── README.md ├── 0803.Bricks-Falling-When-Hit │ ├── 803. Bricks Falling When Hit.go │ ├── 803. Bricks Falling When Hit_test.go │ └── README.md ├── 0807.Max-Increase-to-Keep-City-Skyline │ ├── 807.Max Increase to Keep City Skyline.go │ ├── 807.Max Increase to Keep City Skyline_test.go │ └── README.md ├── 0810.Chalkboard-XOR-Game │ ├── 810. Chalkboard XOR Game.go │ ├── 810. Chalkboard XOR Game_test.go │ └── README.md ├── 0811.Subdomain-Visit-Count │ ├── 811. Subdomain Visit Count.go │ ├── 811. Subdomain Visit Count_test.go │ └── README.md ├── 0812.Largest-Triangle-Area │ ├── 812. Largest Triangle Area.go │ ├── 812. Largest Triangle Area_test.go │ └── README.md ├── 0815.Bus-Routes │ ├── 815. Bus Routes.go │ ├── 815. Bus Routes_test.go │ └── README.md ├── 0816.Ambiguous-Coordinates │ ├── 816. Ambiguous Coordinates.go │ ├── 816. Ambiguous Coordinates_test.go │ └── README.md ├── 0817.Linked-List-Components │ ├── 817. Linked List Components.go │ ├── 817. Linked List Components_test.go │ └── README.md ├── 0819.Most-Common-Word │ ├── 819. Most Common Word.go │ ├── 819. Most Common Word_test.go │ └── README.md ├── 0820.Short-Encoding-of-Words │ ├── 820. Short Encoding of Words.go │ ├── 820. Short Encoding of Words_test.go │ └── README.md ├── 0821.Shortest-Distance-to-a-Character │ ├── 821. Shortest Distance to a Character.go │ ├── 821. Shortest Distance to a Character_test.go │ └── README.md ├── 0823.Binary-Trees-With-Factors │ ├── 823. Binary Trees With Factors.go │ ├── 823. Binary Trees With Factors_test.go │ └── README.md ├── 0825.Friends-Of-Appropriate-Ages │ ├── 825. Friends Of Appropriate Ages.go │ ├── 825. Friends Of Appropriate Ages_test.go │ └── README.md ├── 0826.Most-Profit-Assigning-Work │ ├── 826. Most Profit Assigning Work.go │ ├── 826. Most Profit Assigning Work_test.go │ └── README.md ├── 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String │ ├── 828. Count Unique Characters of All Substrings of a Given String.go │ ├── 828. Count Unique Characters of All Substrings of a Given String_test.go │ └── README.md ├── 0830.Positions-of-Large-Groups │ ├── 830. Positions of Large Groups.go │ ├── 830. Positions of Large Groups_test.go │ └── README.md ├── 0832.Flipping-an-Image │ ├── 832. Flipping an Image.go │ ├── 832. Flipping an Image_test.go │ └── README.md ├── 0834.Sum-of-Distances-in-Tree │ ├── 834. Sum of Distances in Tree.go │ ├── 834. Sum of Distances in Tree_test.go │ └── README.md ├── 0836.Rectangle-Overlap │ ├── 836. Rectangle Overlap.go │ ├── 836. Rectangle Overlap_test.go │ └── README.md ├── 0838.Push-Dominoes │ ├── 838. Push Dominoes.go │ ├── 838. Push Dominoes_test.go │ └── README.md ├── 0839.Similar-String-Groups │ ├── 839. Similar String Groups.go │ ├── 839. Similar String Groups_test.go │ └── README.md ├── 0841.Keys-and-Rooms │ ├── 841. Keys and Rooms.go │ ├── 841. Keys and Rooms_test.go │ └── README.md ├── 0842.Split-Array-into-Fibonacci-Sequence │ ├── 842. Split Array into Fibonacci Sequence.go │ ├── 842. Split Array into Fibonacci Sequence_test.go │ └── README.md ├── 0844.Backspace-String-Compare │ ├── 844. Backspace String Compare.go │ ├── 844. Backspace String Compare_test.go │ └── README.md ├── 0845.Longest-Mountain-in-Array │ ├── 845. Longest Mountain in Array.go │ ├── 845. Longest Mountain in Array_test.go │ └── README.md ├── 0846.Hand-of-Straights │ ├── 846.Hand of Straights.go │ ├── 846.Hand of Straights_test.go │ └── README.md ├── 0850.Rectangle-Area-II │ ├── 850. Rectangle Area II.go │ ├── 850. Rectangle Area II_test.go │ └── README.md ├── 0851.Loud-and-Rich │ ├── 851. Loud and Rich.go │ ├── 851. Loud and Rich_test.go │ └── README.md ├── 0852.Peak-Index-in-a-Mountain-Array │ ├── 852. Peak Index in a Mountain Array.go │ ├── 852. Peak Index in a Mountain Array_test.go │ └── README.md ├── 0853.Car-Fleet │ ├── 853. Car Fleet.go │ ├── 853. Car Fleet_test.go │ └── README.md ├── 0856.Score-of-Parentheses │ ├── 856. Score of Parentheses.go │ ├── 856. Score of Parentheses_test.go │ └── README.md ├── 0859.Buddy-Strings │ ├── 859.Buddy Strings.go │ ├── 859.Buddy Strings_test.go │ └── README.md ├── 0862.Shortest-Subarray-with-Sum-at-Least-K │ ├── 862. Shortest Subarray with Sum at Least K.go │ ├── 862. Shortest Subarray with Sum at Least K_test.go │ └── README.md ├── 0863.All-Nodes-Distance-K-in-Binary-Tree │ ├── 863. All Nodes Distance K in Binary Tree.go │ ├── 863. All Nodes Distance K in Binary Tree_test.go │ └── README.md ├── 0864.Shortest-Path-to-Get-All-Keys │ ├── 864. Shortest Path to Get All Keys.go │ ├── 864. Shortest Path to Get All Keys_test.go │ └── README.md ├── 0867.Transpose-Matrix │ ├── 867. Transpose Matrix.go │ ├── 867. Transpose Matrix_test.go │ └── README.md ├── 0869.Reordered-Power-of-2 │ ├── 869. Reordered Power of 2.go │ ├── 869. Reordered Power of 2_test.go │ └── README.md ├── 0870.Advantage-Shuffle │ ├── 870. Advantage Shuffle.go │ ├── 870. Advantage Shuffle_test.go │ └── README.md ├── 0872.Leaf-Similar-Trees │ ├── 872. Leaf-Similar Trees.go │ ├── 872. Leaf-Similar Trees_test.go │ └── README.md ├── 0874.Walking-Robot-Simulation │ ├── 874. Walking Robot Simulation.go │ ├── 874. Walking Robot Simulation_test.go │ └── README.md ├── 0875.Koko-Eating-Bananas │ ├── 875. Koko Eating Bananas.go │ ├── 875. Koko Eating Bananas_test.go │ └── README.md ├── 0876.Middle-of-the-Linked-List │ ├── 876. Middle of the Linked List.go │ ├── 876. Middle of the Linked List_test.go │ └── README.md ├── 0877.Stone-Game │ ├── 877. Stone Game.go │ ├── 877. Stone Game_test.go │ └── README.md ├── 0878.Nth-Magical-Number │ ├── 878. Nth Magical Number.go │ ├── 878. Nth Magical Number_test.go │ └── README.md ├── 0880.Decoded-String-at-Index │ ├── 880. Decoded String at Index.go │ ├── 880. Decoded String at Index_test.go │ └── README.md ├── 0881.Boats-to-Save-People │ ├── 881. Boats to Save People.go │ ├── 881. Boats to Save People_test.go │ └── README.md ├── 0884.Uncommon-Words-from-Two-Sentences │ ├── 884. Uncommon Words from Two Sentences.go │ ├── 884. Uncommon Words from Two Sentences_test.go │ └── README.md ├── 0885.Spiral-Matrix-III │ ├── 885. Spiral Matrix III.go │ ├── 885. Spiral Matrix III_test.go │ └── README.md ├── 0887.Super-Egg-Drop │ ├── 887. Super Egg Drop.go │ ├── 887. Super Egg Drop_test.go │ └── README.md ├── 0888.Fair-Candy-Swap │ ├── 888. Fair Candy Swap.go │ ├── 888. Fair Candy Swap_test.go │ └── README.md ├── 0890.Find-and-Replace-Pattern │ ├── 890. Find and Replace Pattern.go │ ├── 890. Find and Replace Pattern_test.go │ └── README.md ├── 0891.Sum-of-Subsequence-Widths │ ├── 891. Sum of Subsequence Widths.go │ ├── 891. Sum of Subsequence Widths_test.go │ └── README.md ├── 0892.Surface-Area-of-3D-Shapes │ ├── 892. Surface Area of 3D Shapes.go │ ├── 892. Surface Area of 3D Shapes_test.go │ └── README.md ├── 0895.Maximum-Frequency-Stack │ ├── 895. Maximum Frequency Stack.go │ ├── 895. Maximum Frequency Stack_test.go │ └── README.md ├── 0896.Monotonic-Array │ ├── 896. Monotonic Array.go │ ├── 896. Monotonic Array_test.go │ └── README.md ├── 0897.Increasing-Order-Search-Tree │ ├── 897. Increasing Order Search Tree.go │ ├── 897. Increasing Order Search Tree_test.go │ └── README.md ├── 0898.Bitwise-ORs-of-Subarrays │ ├── 898. Bitwise ORs of Subarrays.go │ ├── 898. Bitwise ORs of Subarrays_test.go │ └── README.md ├── 0901.Online-Stock-Span │ ├── 901. Online Stock Span.go │ ├── 901. Online Stock Span_test.go │ └── README.md ├── 0904.Fruit-Into-Baskets │ ├── 904. Fruit Into Baskets.go │ ├── 904. Fruit Into Baskets_test.go │ └── README.md ├── 0907.Sum-of-Subarray-Minimums │ ├── 907. Sum of Subarray Minimums.go │ ├── 907. Sum of Subarray Minimums_test.go │ └── README.md ├── 0909.Snakes-and-Ladders │ ├── 909. Snakes and Ladders.go │ ├── 909. Snakes and Ladders_test.go │ └── README.md ├── 0910.Smallest-Range-II │ ├── 910.Smallest Range II.go │ ├── 910.Smallest Range II_test.go │ └── README.md ├── 0911.Online-Election │ ├── 911. Online Election.go │ ├── 911. Online Election_test.go │ └── README.md ├── 0914.X-of-a-Kind-in-a-Deck-of-Cards │ ├── 914. X of a Kind in a Deck of Cards.go │ ├── 914. X of a Kind in a Deck of Cards_test.go │ └── README.md ├── 0916.Word-Subsets │ ├── 916. Word Subsets.go │ ├── 916. Word Subsets_test.go │ └── README.md ├── 0918.Maximum-Sum-Circular-Subarray │ ├── 918. Maximum Sum Circular Subarray.go │ ├── 918. Maximum Sum Circular Subarray_test.go │ └── README.md ├── 0920.Number-of-Music-Playlists │ ├── 920. Number of Music Playlists.go │ ├── 920. Number of Music Playlists_test.go │ └── README.md ├── 0921.Minimum-Add-to-Make-Parentheses-Valid │ ├── 921. Minimum Add to Make Parentheses Valid.go │ ├── 921. Minimum Add to Make Parentheses Valid_test.go │ └── README.md ├── 0922.Sort-Array-By-Parity-II │ ├── 922. Sort Array By Parity II.go │ ├── 922. Sort Array By Parity II_test.go │ └── README.md ├── 0923.3Sum-With-Multiplicity │ ├── 923. 3Sum With Multiplicity.go │ ├── 923. 3Sum With Multiplicity_test.go │ └── README.md ├── 0924.Minimize-Malware-Spread │ ├── 924. Minimize Malware Spread.go │ ├── 924. Minimize Malware Spread_test.go │ └── README.md ├── 0925.Long-Pressed-Name │ ├── 925. Long Pressed Name.go │ ├── 925. Long Pressed Name_test.go │ └── README.md ├── 0927.Three-Equal-Parts │ ├── 927. Three Equal Parts.go │ ├── 927. Three Equal Parts_test.go │ └── README.md ├── 0928.Minimize-Malware-Spread-II │ ├── 928. Minimize Malware Spread II.go │ ├── 928. Minimize Malware Spread II_test.go │ └── README.md ├── 0930.Binary-Subarrays-With-Sum │ ├── 930. Binary Subarrays With Sum.go │ ├── 930. Binary Subarrays With Sum_test.go │ └── README.md ├── 0933.Number-of-Recent-Calls │ ├── 933. Number of Recent Calls.go │ ├── 933. Number of Recent Calls_test.go │ └── README.md ├── 0938.Range-Sum-of-BST │ ├── 938. Range Sum of BST.go │ ├── 938. Range Sum of BST_test.go │ └── README.md ├── 0942.DI-String-Match │ ├── 942. DI String Match.go │ ├── 942. DI String Match_test.go │ └── README.md ├── 0946.Validate-Stack-Sequences │ ├── 946. Validate Stack Sequences.go │ ├── 946. Validate Stack Sequences_test.go │ └── README.md ├── 0947.Most-Stones-Removed-with-Same-Row-or-Column │ ├── 947. Most Stones Removed with Same Row or Column.go │ ├── 947. Most Stones Removed with Same Row or Column_test.go │ └── README.md ├── 0949.Largest-Time-for-Given-Digits │ ├── 949. Largest Time for Given Digits.go │ ├── 949. Largest Time for Given Digits_test.go │ └── README.md ├── 0952.Largest-Component-Size-by-Common-Factor │ ├── 952. Largest Component Size by Common Factor.go │ ├── 952. Largest Component Size by Common Factor_test.go │ └── README.md ├── 0953.Verifying-an-Alien-Dictionary │ ├── 953. Verifying an Alien Dictionary.go │ ├── 953. Verifying an Alien Dictionary_test.go │ └── README.md ├── 0958.Check-Completeness-of-a-Binary-Tree │ ├── 0958.Check Completeness of a Binary Tree.go │ ├── 0958.Check Completeness of a Binary Tree_test.go │ └── README.md ├── 0959.Regions-Cut-By-Slashes │ ├── 959. Regions Cut By Slashes.go │ ├── 959. Regions Cut By Slashes_test.go │ └── README.md ├── 0961.N-Repeated-Element-in-Size-2N-Array │ ├── 961. N-Repeated Element in Size 2N Array.go │ ├── 961. N-Repeated Element in Size 2N Array_test.go │ └── README.md ├── 0966.Vowel-Spellchecker │ ├── 966. Vowel Spellchecker.go │ ├── 966. Vowel Spellchecker_test.go │ └── README.md ├── 0968.Binary-Tree-Cameras │ ├── 968. Binary Tree Cameras.go │ ├── 968. Binary Tree Cameras_test.go │ └── README.md ├── 0969.Pancake-Sorting │ ├── 969. Pancake Sorting.go │ ├── 969. Pancake Sorting_test.go │ └── README.md ├── 0970.Powerful-Integers │ ├── 970. Powerful Integers.go │ ├── 970. Powerful Integers_test.go │ └── README.md ├── 0971.Flip-Binary-Tree-To-Match-Preorder-Traversal │ ├── 971. Flip Binary Tree To Match Preorder Traversal.go │ ├── 971. Flip Binary Tree To Match Preorder Traversal_test.go │ └── README.md ├── 0973.K-Closest-Points-to-Origin │ ├── 973. K Closest Points to Origin.go │ ├── 973. K Closest Points to Origin_test.go │ └── README.md ├── 0976.Largest-Perimeter-Triangle │ ├── 976. Largest Perimeter Triangle.go │ ├── 976. Largest Perimeter Triangle_test.go │ └── README.md ├── 0977.Squares-of-a-Sorted-Array │ ├── 977. Squares of a Sorted Array.go │ ├── 977. Squares of a Sorted Array_test.go │ └── README.md ├── 0978.Longest-Turbulent-Subarray │ ├── 978. Longest Turbulent Subarray.go │ ├── 978. Longest Turbulent Subarray_test.go │ └── README.md ├── 0979.Distribute-Coins-in-Binary-Tree │ ├── 979. Distribute Coins in Binary Tree.go │ ├── 979. Distribute Coins in Binary Tree_test.go │ └── README.md ├── 0980.Unique-Paths-III │ ├── 980. Unique Paths III.go │ ├── 980. Unique Paths III_test.go │ └── README.md ├── 0981.Time-Based-Key-Value-Store │ ├── 981. Time Based Key-Value Store.go │ ├── 981. Time Based Key-Value Store_test.go │ └── README.md ├── 0984.String-Without-AAA-or-BBB │ ├── 984. String Without AAA or BBB.go │ ├── 984. String Without AAA or BBB_test.go │ └── README.md ├── 0985.Sum-of-Even-Numbers-After-Queries │ ├── 985. Sum of Even Numbers After Queries.go │ ├── 985. Sum of Even Numbers After Queries_test.go │ └── README.md ├── 0986.Interval-List-Intersections │ ├── 986. Interval List Intersections.go │ ├── 986. Interval List Intersections_test.go │ └── README.md ├── 0987.Vertical-Order-Traversal-of-a-Binary-Tree │ ├── 987. Vertical Order Traversal of a Binary Tree.go │ ├── 987. Vertical Order Traversal of a Binary Tree_test.go │ └── README.md ├── 0989.Add-to-Array-Form-of-Integer │ ├── 989. Add to Array-Form of Integer.go │ ├── 989. Add to Array-Form of Integer_test.go │ └── README.md ├── 0990.Satisfiability-of-Equality-Equations │ ├── 990. Satisfiability of Equality Equations.go │ ├── 990. Satisfiability of Equality Equations_test.go │ └── README.md ├── 0991.Broken-Calculator │ ├── 991. Broken Calculator.go │ ├── 991. Broken Calculator_test.go │ └── README.md ├── 0992.Subarrays-with-K-Different-Integers │ ├── 992. Subarrays with K Different Integers.go │ ├── 992. Subarrays with K Different Integers_test.go │ └── README.md ├── 0993.Cousins-in-Binary-Tree │ ├── 993. Cousins in Binary Tree.go │ ├── 993. Cousins in Binary Tree_test.go │ └── README.md ├── 0995.Minimum-Number-of-K-Consecutive-Bit-Flips │ ├── 995. Minimum Number of K Consecutive Bit Flips.go │ ├── 995. Minimum Number of K Consecutive Bit Flips_test.go │ └── README.md ├── 0996.Number-of-Squareful-Arrays │ ├── 996. Number of Squareful Arrays.go │ ├── 996. Number of Squareful Arrays_test.go │ └── README.md ├── 0997.Find-the-Town-Judge │ ├── 997.Find the Town Judge.go │ ├── 997.Find the Town Judge_test.go │ └── README.md ├── 0999.Available-Captures-for-Rook │ ├── 999. Available Captures for Rook.go │ ├── 999. Available Captures for Rook_test.go │ └── README.md ├── 1002.Find-Common-Characters │ ├── 1002. Find Common Characters.go │ ├── 1002. Find Common Characters_test.go │ └── README.md ├── 1003.Check-If-Word-Is-Valid-After-Substitutions │ ├── 1003. Check If Word Is Valid After Substitutions.go │ ├── 1003. Check If Word Is Valid After Substitutions_test.go │ └── README.md ├── 1004.Max-Consecutive-Ones-III │ ├── 1004. Max Consecutive Ones III.go │ ├── 1004. Max Consecutive Ones III_test.go │ └── README.md ├── 1005.Maximize-Sum-Of-Array-After-K-Negations │ ├── 1005. Maximize Sum Of Array After K Negations.go │ ├── 1005. Maximize Sum Of Array After K Negations_test.go │ └── README.md ├── 1006.Clumsy-Factorial │ ├── 1006. Clumsy Factorial.go │ ├── 1006. Clumsy Factorial_test.go │ └── README.md ├── 1009.Complement-of-Base-10-Integer │ ├── 1009. Complement of Base 10 Integer.go │ ├── 1009. Complement of Base 10 Integer_test.go │ └── README.md ├── 1010.Pairs-of-Songs-With-Total-Durations-Divisible-by-60 │ ├── 1010. Pairs of Songs With Total Durations Divisible by 60.go │ ├── 1010. Pairs of Songs With Total Durations Divisible by 60_test.go │ └── README.md ├── 1011.Capacity-To-Ship-Packages-Within-D-Days │ ├── 1011. Capacity To Ship Packages Within D Days.go │ ├── 1011. Capacity To Ship Packages Within D Days_test.go │ └── README.md ├── 1017.Convert-to-Base-2 │ ├── 1017. Convert to Base -2.go │ ├── 1017. Convert to Base -2_test.go │ └── README.md ├── 1018.Binary-Prefix-Divisible-By-5 │ ├── 1018. Binary Prefix Divisible By 5.go │ ├── 1018. Binary Prefix Divisible By 5_test.go │ └── README.md ├── 1019.Next-Greater-Node-In-Linked-List │ ├── 1019. Next Greater Node In Linked List.go │ ├── 1019. Next Greater Node In Linked List_test.go │ └── README.md ├── 1020.Number-of-Enclaves │ ├── 1020. Number of Enclaves.go │ ├── 1020. Number of Enclaves_test.go │ └── README.md ├── 1021.Remove-Outermost-Parentheses │ ├── 1021. Remove Outermost Parentheses.go │ ├── 1021. Remove Outermost Parentheses_test.go │ └── README.md ├── 1022.Sum-of-Root-To-Leaf-Binary-Numbers │ ├── 1022. Sum of Root To Leaf Binary Numbers.go │ ├── 1022. Sum of Root To Leaf Binary Numbers_test.go │ └── README.md ├── 1025.Divisor-Game │ ├── 1025. Divisor Game.go │ ├── 1025. Divisor Game_test.go │ └── README.md ├── 1026.Maximum-Difference-Between-Node-and-Ancestor │ ├── 1026. Maximum Difference Between Node and Ancestor.go │ ├── 1026. Maximum Difference Between Node and Ancestor_test.go │ └── README.md ├── 1028.Recover-a-Tree-From-Preorder-Traversal │ ├── 1028. Recover a Tree From Preorder Traversal.go │ ├── 1028. Recover a Tree From Preorder Traversal_test.go │ └── README.md ├── 1030.Matrix-Cells-in-Distance-Order │ ├── 1030. Matrix Cells in Distance Order.go │ ├── 1030. Matrix Cells in Distance Order_test.go │ └── README.md ├── 1034.Coloring-A-Border │ ├── 1034.Coloring A Border.go │ ├── 1034.Coloring A Border_test.go │ └── README.md ├── 1037.Valid-Boomerang │ ├── 1037. Valid Boomerang.go │ ├── 1037. Valid Boomerang_test.go │ └── README.md ├── 1038.Binary-Search-Tree-to-Greater-Sum-Tree │ ├── 1038. Binary Search Tree to Greater Sum Tree.go │ ├── 1038. Binary Search Tree to Greater Sum Tree_test.go │ └── README.md ├── 1040.Moving-Stones-Until-Consecutive-II │ ├── 1040. Moving Stones Until Consecutive II.go │ ├── 1040. Moving Stones Until Consecutive II_test.go │ └── README.md ├── 1047.Remove-All-Adjacent-Duplicates-In-String │ ├── 1047. Remove All Adjacent Duplicates In String.go │ ├── 1047. Remove All Adjacent Duplicates In String_test.go │ └── README.md ├── 1048.Longest-String-Chain │ ├── 1048. Longest String Chain.go │ ├── 1048. Longest String Chain_test.go │ └── README.md ├── 1049.Last-Stone-Weight-II │ ├── 1049. Last Stone Weight II.go │ ├── 1049. Last Stone Weight II_test.go │ └── README.md ├── 1051.Height-Checker │ ├── 1051. Height Checker.go │ ├── 1051. Height Checker_test.go │ └── README.md ├── 1052.Grumpy-Bookstore-Owner │ ├── 1052. Grumpy Bookstore Owner.go │ ├── 1052. Grumpy Bookstore Owner_test.go │ └── README.md ├── 1054.Distant-Barcodes │ ├── 1054. Distant Barcodes.go │ ├── 1054. Distant Barcodes_test.go │ └── README.md ├── 1073.Adding-Two-Negabinary-Numbers │ ├── 1073. Adding Two Negabinary Numbers.go │ ├── 1073. Adding Two Negabinary Numbers_test.go │ └── README.md ├── 1074.Number-of-Submatrices-That-Sum-to-Target │ ├── 1074. Number of Submatrices That Sum to Target.go │ ├── 1074. Number of Submatrices That Sum to Target_test.go │ └── README.md ├── 1078.Occurrences-After-Bigram │ ├── 1078. Occurrences After Bigram.go │ ├── 1078. Occurrences After Bigram_test.go │ └── README.md ├── 1079.Letter-Tile-Possibilities │ ├── 1079. Letter Tile Possibilities.go │ ├── 1079. Letter Tile Possibilities_test.go │ └── README.md ├── 1089.Duplicate-Zeros │ ├── 1089. Duplicate Zeros.go │ ├── 1089. Duplicate Zeros_test.go │ └── README.md ├── 1091.Shortest-Path-in-Binary-Matrix │ ├── 1091. Shortest Path in Binary Matrix.go │ ├── 1091. Shortest Path in Binary Matrix_test.go │ └── README.md ├── 1093.Statistics-from-a-Large-Sample │ ├── 1093. Statistics from a Large Sample.go │ ├── 1093. Statistics from a Large Sample_test.go │ └── README.md ├── 1104.Path-In-Zigzag-Labelled-Binary-Tree │ ├── 1104.Path In Zigzag Labelled Binary Tree.go │ ├── 1104.Path In Zigzag Labelled Binary Tree_test.go │ └── README.md ├── 1105.Filling-Bookcase-Shelves │ ├── 1105. Filling Bookcase Shelves.go │ ├── 1105. Filling Bookcase Shelves_test.go │ └── README.md ├── 1108.Defanging-an-IP-Address │ ├── 1108. Defanging an IP Address.go │ ├── 1108. Defanging an IP Address_test.go │ └── README.md ├── 1110.Delete-Nodes-And-Return-Forest │ ├── 1110. Delete Nodes And Return Forest.go │ ├── 1110. Delete Nodes And Return Forest_test.go │ └── README.md ├── 1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings │ ├── 1111. Maximum Nesting Depth of Two Valid Parentheses Strings.go │ ├── 1111. Maximum Nesting Depth of Two Valid Parentheses Strings_test.go │ └── README.md ├── 1122.Relative-Sort-Array │ ├── 1122. Relative Sort Array.go │ ├── 1122. Relative Sort Array_test.go │ └── README.md ├── 1123.Lowest-Common-Ancestor-of-Deepest-Leaves │ ├── 1123. Lowest Common Ancestor of Deepest Leaves.go │ ├── 1123. Lowest Common Ancestor of Deepest Leaves_test.go │ └── README.md ├── 1128.Number-of-Equivalent-Domino-Pairs │ ├── 1128. Number of Equivalent Domino Pairs.go │ ├── 1128. Number of Equivalent Domino Pairs_test.go │ └── README.md ├── 1137.N-th-Tribonacci-Number │ ├── 1137. N-th Tribonacci Number.go │ ├── 1137. N-th Tribonacci Number_test.go │ └── README.md ├── 1143.Longest-Common-Subsequence │ ├── 1143. Longest Common Subsequence.go │ ├── 1143. Longest Common Subsequence_test.go │ └── README.md ├── 1145.Binary-Tree-Coloring-Game │ ├── 1145. Binary Tree Coloring Game.go │ ├── 1145. Binary Tree Coloring Game_test.go │ └── README.md ├── 1154.Day-of-the-Year │ ├── 1154. Day of the Year.go │ ├── 1154. Day of the Year_test.go │ └── README.md ├── 1157.Online-Majority-Element-In-Subarray │ ├── 1157. Online Majority Element In Subarray.go │ ├── 1157. Online Majority Element In Subarray_test.go │ └── README.md ├── 1160.Find-Words-That-Can-Be-Formed-by-Characters │ ├── 1160. Find Words That Can Be Formed by Characters.go │ ├── 1160. Find Words That Can Be Formed by Characters_test.go │ └── README.md ├── 1170.Compare-Strings-by-Frequency-of-the-Smallest-Character │ ├── 1170. Compare Strings by Frequency of the Smallest Character.go │ ├── 1170. Compare Strings by Frequency of the Smallest Character_test.go │ └── README.md ├── 1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List │ ├── 1171. Remove Zero Sum Consecutive Nodes from Linked List.go │ ├── 1171. Remove Zero Sum Consecutive Nodes from Linked List_test.go │ └── README.md ├── 1175.Prime-Arrangements │ ├── 1175. Prime Arrangements.go │ ├── 1175. Prime Arrangements_test.go │ └── README.md ├── 1178.Number-of-Valid-Words-for-Each-Puzzle │ ├── 1178. Number of Valid Words for Each Puzzle.go │ ├── 1178. Number of Valid Words for Each Puzzle_test.go │ └── README.md ├── 1184.Distance-Between-Bus-Stops │ ├── 1184. Distance Between Bus Stops.go │ ├── 1184. Distance Between Bus Stops_test.go │ └── README.md ├── 1185.Day-of-the-Week │ ├── 1185. Day of the Week.go │ ├── 1185. Day of the Week_test.go │ └── README.md ├── 1189.Maximum-Number-of-Balloons │ ├── 1189. Maximum Number of Balloons.go │ ├── 1189. Maximum Number of Balloons_test.go │ └── README.md ├── 1190.Reverse-Substrings-Between-Each-Pair-of-Parentheses │ ├── 1190. Reverse Substrings Between Each Pair of Parentheses.go │ ├── 1190. Reverse Substrings Between Each Pair of Parentheses_test.go │ └── README.md ├── 1200.Minimum-Absolute-Difference │ ├── 1200. Minimum Absolute Difference.go │ ├── 1200. Minimum Absolute Difference_test.go │ └── README.md ├── 1201.Ugly-Number-III │ ├── 1201. Ugly Number III.go │ ├── 1201. Ugly Number III_test.go │ └── README.md ├── 1202.Smallest-String-With-Swaps │ ├── 1202. Smallest String With Swaps.go │ ├── 1202. Smallest String With Swaps_test.go │ └── README.md ├── 1203.Sort-Items-by-Groups-Respecting-Dependencies │ ├── 1203. Sort Items by Groups Respecting Dependencies.go │ ├── 1203. Sort Items by Groups Respecting Dependencies_test.go │ └── README.md ├── 1207.Unique-Number-of-Occurrences │ ├── 1207. Unique Number of Occurrences.go │ ├── 1207. Unique Number of Occurrences_test.go │ └── README.md ├── 1208.Get-Equal-Substrings-Within-Budget │ ├── 1208. Get Equal Substrings Within Budget.go │ ├── 1208. Get Equal Substrings Within Budget_test.go │ └── README.md ├── 1209.Remove-All-Adjacent-Duplicates-in-String-II │ ├── 1209. Remove All Adjacent Duplicates in String II.go │ ├── 1209. Remove All Adjacent Duplicates in String II_test.go │ └── README.md ├── 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position │ ├── 1217. Minimum Cost to Move Chips to The Same Position.go │ ├── 1217. Minimum Cost to Move Chips to The Same Position_test.go │ └── README.md ├── 1221.Split-a-String-in-Balanced-Strings │ ├── 1221. Split a String in Balanced Strings.go │ ├── 1221. Split a String in Balanced Strings_test.go │ └── README.md ├── 1232.Check-If-It-Is-a-Straight-Line │ ├── 1232. Check If It Is a Straight Line.go │ ├── 1232. Check If It Is a Straight Line_test.go │ └── README.md ├── 1234.Replace-the-Substring-for-Balanced-String │ ├── 1234. Replace the Substring for Balanced String.go │ ├── 1234. Replace the Substring for Balanced String_test.go │ └── README.md ├── 1235.Maximum-Profit-in-Job-Scheduling │ ├── 1235. Maximum Profit in Job Scheduling.go │ ├── 1235. Maximum Profit in Job Scheduling_test.go │ └── README.md ├── 1239.Maximum-Length-of-a-Concatenated-String-with-Unique-Characters │ ├── 1239. Maximum Length of a Concatenated String with Unique Characters.go │ ├── 1239. Maximum Length of a Concatenated String with Unique Characters_test.go │ └── README.md ├── 1249.Minimum-Remove-to-Make-Valid-Parentheses │ ├── 1249. Minimum Remove to Make Valid Parentheses.go │ ├── 1249. Minimum Remove to Make Valid Parentheses_test.go │ └── README.md ├── 1252.Cells-with-Odd-Values-in-a-Matrix │ ├── 1252. Cells with Odd Values in a Matrix.go │ ├── 1252. Cells with Odd Values in a Matrix_test.go │ └── README.md ├── 1254.Number-of-Closed-Islands │ ├── 1254. Number of Closed Islands.go │ ├── 1254. Number of Closed Islands_test.go │ └── README.md ├── 1260.Shift-2D-Grid │ ├── 1260. Shift 2D Grid.go │ ├── 1260. Shift 2D Grid_test.go │ └── README.md ├── 1266.Minimum-Time-Visiting-All-Points │ ├── 1266. Minimum Time Visiting All Points.go │ ├── 1266. Minimum Time Visiting All Points_test.go │ └── README.md ├── 1268.Search-Suggestions-System │ ├── 1268. Search Suggestions System.go │ ├── 1268. Search Suggestions System_test.go │ └── README.md ├── 1275.Find-Winner-on-a-Tic-Tac-Toe-Game │ ├── 1275. Find Winner on a Tic Tac Toe Game.go │ ├── 1275. Find Winner on a Tic Tac Toe Game_test.go │ └── README.md ├── 1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer │ ├── 1281. Subtract the Product and Sum of Digits of an Integer.go │ ├── 1281. Subtract the Product and Sum of Digits of an Integer_test.go │ └── README.md ├── 1283.Find-the-Smallest-Divisor-Given-a-Threshold │ ├── 1283. Find the Smallest Divisor Given a Threshold.go │ ├── 1283. Find the Smallest Divisor Given a Threshold_test.go │ └── README.md ├── 1287.Element-Appearing-More-Than-In-Sorted-Array │ ├── 1287. Element Appearing More Than 25% In Sorted Array.go │ ├── 1287. Element Appearing More Than 25% In Sorted Array_test.go │ └── README.md ├── 1290.Convert-Binary-Number-in-a-Linked-List-to-Integer │ ├── 1290. Convert Binary Number in a Linked List to Integer.go │ ├── 1290. Convert Binary Number in a Linked List to Integer_test.go │ └── README.md ├── 1293.Shortest-Path-in-a-Grid-with-Obstacles-Elimination │ ├── 1293. Shortest Path in a Grid with Obstacles Elimination.go │ ├── 1293. Shortest Path in a Grid with Obstacles Elimination_test.go │ └── README.md ├── 1295.Find-Numbers-with-Even-Number-of-Digits │ ├── 1295. Find Numbers with Even Number of Digits.go │ ├── 1295. Find Numbers with Even Number of Digits_test.go │ └── README.md ├── 1296.Divide-Array-in-Sets-of-K-Consecutive-Numbers │ ├── 1296.Divide Array in Sets of K Consecutive Numbers.go │ ├── 1296.Divide Array in Sets of K Consecutive Numbers_test.go │ └── README.md ├── 1299.Replace-Elements-with-Greatest-Element-on-Right-Side │ ├── 1299. Replace Elements with Greatest Element on Right Side.go │ ├── 1299. Replace Elements with Greatest Element on Right Side_test.go │ └── README.md ├── 1300.Sum-of-Mutated-Array-Closest-to-Target │ ├── 1300. Sum of Mutated Array Closest to Target.go │ ├── 1300. Sum of Mutated Array Closest to Target_test.go │ └── README.md ├── 1302.Deepest-Leaves-Sum │ ├── 1302. Deepest Leaves Sum.go │ ├── 1302. Deepest Leaves Sum_test.go │ └── README.md ├── 1304.Find-N-Unique-Integers-Sum-up-to-Zero │ ├── 1304. Find N Unique Integers Sum up to Zero.go │ ├── 1304. Find N Unique Integers Sum up to Zero_test.go │ └── README.md ├── 1305.All-Elements-in-Two-Binary-Search-Trees │ ├── 1305. All Elements in Two Binary Search Trees.go │ ├── 1305. All Elements in Two Binary Search Trees_test.go │ └── README.md ├── 1306.Jump-Game-III │ ├── 1306. Jump Game III.go │ ├── 1306. Jump Game III_test.go │ └── README.md ├── 1310.XOR-Queries-of-a-Subarray │ ├── 1310. XOR Queries of a Subarray.go │ ├── 1310. XOR Queries of a Subarray_test.go │ └── README.md ├── 1313.Decompress-Run-Length-Encoded-List │ ├── 1313. Decompress Run-Length Encoded List.go │ ├── 1313. Decompress Run-Length Encoded List_test.go │ └── README.md ├── 1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers │ ├── 1317. Convert Integer to the Sum of Two No-Zero Integers.go │ ├── 1317. Convert Integer to the Sum of Two No-Zero Integers_test.go │ └── README.md ├── 1319.Number-of-Operations-to-Make-Network-Connected │ ├── 1319. Number of Operations to Make Network Connected.go │ ├── 1319. Number of Operations to Make Network Connected_test.go │ └── README.md ├── 1329.Sort-the-Matrix-Diagonally │ ├── 1329. Sort the Matrix Diagonally.go │ ├── 1329. Sort the Matrix Diagonally_test.go │ └── README.md ├── 1332.Remove-Palindromic-Subsequences │ ├── 1332. Remove Palindromic Subsequences.go │ ├── 1332. Remove Palindromic Subsequences_test.go │ └── README.md ├── 1337.The-K-Weakest-Rows-in-a-Matrix │ ├── 1337. The K Weakest Rows in a Matrix.go │ ├── 1337. The K Weakest Rows in a Matrix_test.go │ └── README.md ├── 1353.Maximum-Number-of-Events-That-Can-Be-Attended │ ├── 1353. Maximum Number of Events That Can Be Attended.go │ ├── 1353. Maximum Number of Events That Can Be Attended_test.go │ └── README.md ├── 1380.Lucky-Numbers-in-a-Matrix │ ├── 1380. Lucky Numbers in a Matrix.go │ ├── 1380. Lucky Numbers in a Matrix_test.go │ └── README.md ├── 1383.Maximum-Performance-of-a-Team │ ├── 1383. Maximum Performance of a Team.go │ ├── 1383. Maximum Performance of a Team_test.go │ └── README.md ├── 1385.Find-the-Distance-Value-Between-Two-Arrays │ ├── 1385. Find the Distance Value Between Two Arrays.go │ ├── 1385. Find the Distance Value Between Two Arrays_test.go │ └── README.md ├── 1389.Create-Target-Array-in-the-Given-Order │ ├── 1389. Create Target Array in the Given Order.go │ ├── 1389. Create Target Array in the Given Order_test.go │ └── README.md ├── 1396.Design-Underground-System │ ├── 1396. Design Underground System.go │ ├── 1396. Design Underground System_test.go │ └── README.md ├── 1423.Maximum-Points-You-Can-Obtain-from-Cards │ ├── 1423. Maximum Points You Can Obtain from Cards.go │ ├── 1423. Maximum Points You Can Obtain from Cards_test.go │ └── README.md ├── 1437.Check-If-All-1s-Are-at-Least-Length-K-Places-Away │ ├── 1437. Check If All 1s Are at Least Length K Places Away.go │ ├── 1437. Check If All 1s Are at Least Length K Places Away_test.go │ └── README.md ├── 1438.Longest-Continuous-Subarray-With-Absolute-Diff-Less-Than-or-Equal-to-Limit │ ├── 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit.go │ ├── 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit_test.go │ └── README.md ├── 1439.Find-the-Kth-Smallest-Sum-of-a-Matrix-With-Sorted-Rows │ ├── 1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows.go │ ├── 1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows_test.go │ └── README.md ├── 1442.Count-Triplets-That-Can-Form-Two-Arrays-of-Equal-XOR │ ├── 1442. Count Triplets That Can Form Two Arrays of Equal XOR.go │ ├── 1442. Count Triplets That Can Form Two Arrays of Equal XOR_test.go │ └── README.md ├── 1446.Consecutive-Characters │ ├── 1446.Consecutive Characters.go │ ├── 1446.Consecutive Characters_test.go │ └── README.md ├── 1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence │ ├── 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence.go │ ├── 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_test.go │ └── README.md ├── 1461.Check-If-a-String-Contains-All-Binary-Codes-of-Size-K │ ├── 1461. Check If a String Contains All Binary Codes of Size K.go │ ├── 1461. Check If a String Contains All Binary Codes of Size K_test.go │ └── README.md ├── 1463.Cherry-Pickup-II │ ├── 1463. Cherry Pickup II.go │ ├── 1463. Cherry Pickup II_test.go │ └── README.md ├── 1464.Maximum-Product-of-Two-Elements-in-an-Array │ ├── 1464. Maximum Product of Two Elements in an Array.go │ ├── 1464. Maximum Product of Two Elements in an Array_test.go │ └── README.md ├── 1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts │ ├── 1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts.go │ ├── 1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts_test.go │ └── README.md ├── 1470.Shuffle-the-Array │ ├── 1470. Shuffle the Array.go │ ├── 1470. Shuffle the Array_test.go │ └── README.md ├── 1480.Running-Sum-of-1d-Array │ ├── 1480. Running Sum of 1d Array.go │ ├── 1480. Running Sum of 1d Array_test.go │ └── README.md ├── 1482.Minimum-Number-of-Days-to-Make-m-Bouquets │ ├── 1482. Minimum Number of Days to Make m Bouquets.go │ ├── 1482. Minimum Number of Days to Make m Bouquets_test.go │ └── README.md ├── 1486.XOR-Operation-in-an-Array │ ├── 1486. XOR Operation in an Array.go │ ├── 1486. XOR Operation in an Array_test.go │ └── README.md ├── 1512.Number-of-Good-Pairs │ ├── 1512. Number of Good Pairs.go │ ├── 1512. Number of Good Pairs_test.go │ └── README.md ├── 1518.Water-Bottles │ ├── 1518.Water Bottles.go │ ├── 1518.Water Bottles_test.go │ └── README.md ├── 1539.Kth-Missing-Positive-Number │ ├── 1539. Kth Missing Positive Number.go │ ├── 1539. Kth Missing Positive Number_test.go │ └── README.md ├── 1551.Minimum-Operations-to-Make-Array-Equal │ ├── 1551. Minimum Operations to Make Array Equal.go │ ├── 1551. Minimum Operations to Make Array Equal_test.go │ └── README.md ├── 1572.Matrix-Diagonal-Sum │ ├── 1572.Matrix Diagonal Sum.go │ ├── 1572.Matrix Diagonal Sum_test.go │ └── README.md ├── 1573.Number-of-Ways-to-Split-a-String │ ├── 1573. Number of Ways to Split a String.go │ ├── 1573. Number of Ways to Split a String_test.go │ └── README.md ├── 1576.Replace-All-s-to-Avoid-Consecutive-Repeating-Characters │ ├── 1576. Replace-All-s-to-Avoid-Consecutive-Repeating-Characters.go │ ├── 1576. Replace-All-s-to-Avoid-Consecutive-Repeating-Characters_test.go │ └── README.md ├── 1579.Remove-Max-Number-of-Edges-to-Keep-Graph-Fully-Traversable │ ├── 1579. Remove Max Number of Edges to Keep Graph Fully Traversable.go │ ├── 1579. Remove Max Number of Edges to Keep Graph Fully Traversable_test.go │ └── README.md ├── 1600.Throne-Inheritance │ ├── 1600. Throne Inheritance.go │ ├── 1600. Throne Inheritance_test.go │ └── README.md ├── 1603.Design-Parking-System │ ├── 1603. Design Parking System.go │ ├── 1603. Design Parking System_test.go │ └── README.md ├── 1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X │ ├── 1608. Special Array With X Elements Greater Than or Equal X.go │ ├── 1608. Special Array With X Elements Greater Than or Equal X_test.go │ └── README.md ├── 1609.Even-Odd-Tree │ ├── 1609.Even Odd Tree.go │ ├── 1609.Even Odd Tree_test.go │ └── README.md ├── 1614.Maximum-Nesting-Depth-of-the-Parentheses │ ├── 1614. Maximum Nesting Depth of the Parentheses.go │ ├── 1614. Maximum Nesting Depth of the Parentheses_test.go │ └── README.md ├── 1619.Mean-of-Array-After-Removing-Some-Elements │ ├── 1619. Mean of Array After Removing Some Elements.go │ ├── 1619. Mean of Array After Removing Some Elements_test.go │ └── README.md ├── 1624.Largest-Substring-Between-Two-Equal-Characters │ ├── 1624. Largest Substring Between Two Equal Characters.go │ ├── 1624. Largest Substring Between Two Equal Characters_test.go │ └── README.md ├── 1629.Slowest-Key │ ├── 1629. Slowest Key.go │ ├── 1629. Slowest Key_test.go │ └── README.md ├── 1631.Path-With-Minimum-Effort │ ├── 1631. Path With Minimum Effort.go │ ├── 1631. Path With Minimum Effort_test.go │ └── README.md ├── 1636.Sort-Array-by-Increasing-Frequency │ ├── 1636. Sort Array by Increasing Frequency.go │ ├── 1636. Sort Array by Increasing Frequency_test.go │ └── README.md ├── 1640.Check-Array-Formation-Through-Concatenation │ ├── 1640. Check Array Formation Through Concatenation.go │ ├── 1640. Check Array Formation Through Concatenation_test.go │ └── README.md ├── 1641.Count-Sorted-Vowel-Strings │ ├── 1641. Count Sorted Vowel Strings.go │ ├── 1641. Count Sorted Vowel Strings_test.go │ └── README.md ├── 1642.Furthest-Building-You-Can-Reach │ ├── 1642. Furthest Building You Can Reach.go │ ├── 1642. Furthest Building You Can Reach_test.go │ └── README.md ├── 1646.Get-Maximum-in-Generated-Array │ ├── 1646. Get Maximum in Generated Array.go │ ├── 1646. Get Maximum in Generated Array_test.go │ └── README.md ├── 1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique │ ├── 1647. Minimum Deletions to Make Character Frequencies Unique.go │ ├── 1647. Minimum Deletions to Make Character Frequencies Unique_test.go │ └── README.md ├── 1648.Sell-Diminishing-Valued-Colored-Balls │ ├── 1648. Sell Diminishing-Valued Colored Balls.go │ ├── 1648. Sell Diminishing-Valued Colored Balls_test.go │ └── README.md ├── 1649.Create-Sorted-Array-through-Instructions │ ├── 1649. Create Sorted Array through Instructions.go │ ├── 1649. Create Sorted Array through Instructions_test.go │ └── README.md ├── 1652.Defuse-the-Bomb │ ├── 1652. Defuse the Bomb.go │ ├── 1652. Defuse the Bomb_test.go │ └── README.md ├── 1653.Minimum-Deletions-to-Make-String-Balanced │ ├── 1653. Minimum Deletions to Make String Balanced.go │ ├── 1653. Minimum Deletions to Make String Balanced_test.go │ └── README.md ├── 1654.Minimum-Jumps-to-Reach-Home │ ├── 1654. Minimum Jumps to Reach Home.go │ ├── 1654. Minimum Jumps to Reach Home_test.go │ └── README.md ├── 1655.Distribute-Repeating-Integers │ ├── 1655. Distribute Repeating Integers.go │ ├── 1655. Distribute Repeating Integers_test.go │ └── README.md ├── 1656.Design-an-Ordered-Stream │ ├── 1656. Design an Ordered Stream.go │ ├── 1656. Design an Ordered Stream_test.go │ └── README.md ├── 1657.Determine-if-Two-Strings-Are-Close │ ├── 1657. Determine if Two Strings Are Close.go │ ├── 1657. Determine if Two Strings Are Close_test.go │ └── README.md ├── 1658.Minimum-Operations-to-Reduce-X-to-Zero │ ├── 1658. Minimum Operations to Reduce X to Zero.go │ ├── 1658. Minimum Operations to Reduce X to Zero_test.go │ └── README.md ├── 1659.Maximize-Grid-Happiness │ ├── 1659. Maximize Grid Happiness.go │ ├── 1659. Maximize Grid Happiness_test.go │ └── README.md ├── 1662.Check-If-Two-String-Arrays-are-Equivalent │ ├── 1662. Check If Two String Arrays are Equivalent.go │ ├── 1662. Check If Two String Arrays are Equivalent_test.go │ └── README.md ├── 1663.Smallest-String-With-A-Given-Numeric-Value │ ├── 1663. Smallest String With A Given Numeric Value.go │ ├── 1663. Smallest String With A Given Numeric Value_test.go │ └── README.md ├── 1664.Ways-to-Make-a-Fair-Array │ ├── 1664. Ways to Make a Fair Array.go │ ├── 1664. Ways to Make a Fair Array_test.go │ └── README.md ├── 1665.Minimum-Initial-Energy-to-Finish-Tasks │ ├── 1665. Minimum Initial Energy to Finish Tasks.go │ ├── 1665. Minimum Initial Energy to Finish Tasks_test.go │ └── README.md ├── 1668.Maximum-Repeating-Substring │ ├── 1668. Maximum Repeating Substring.go │ ├── 1668. Maximum Repeating Substring_test.go │ └── README.md ├── 1669.Merge-In-Between-Linked-Lists │ ├── 1669. Merge In Between Linked Lists.go │ ├── 1669. Merge In Between Linked Lists_test.go │ └── README.md ├── 1670.Design-Front-Middle-Back-Queue │ ├── 1670. Design Front Middle Back Queue.go │ ├── 1670. Design Front Middle Back Queue_test.go │ └── README.md ├── 1672.Richest-Customer-Wealth │ ├── 1672. Richest Customer Wealth.go │ ├── 1672. Richest Customer Wealth_test.go │ └── README.md ├── 1673.Find-the-Most-Competitive-Subsequence │ ├── 1673. Find the Most Competitive Subsequence.go │ ├── 1673. Find the Most Competitive Subsequence_test.go │ └── README.md ├── 1674.Minimum-Moves-to-Make-Array-Complementary │ ├── 1674. Minimum Moves to Make Array Complementary.go │ ├── 1674. Minimum Moves to Make Array Complementary_test.go │ └── README.md ├── 1675.Minimize-Deviation-in-Array │ ├── 1675. Minimize Deviation in Array.go │ ├── 1675. Minimize Deviation in Array_test.go │ └── README.md ├── 1678.Goal-Parser-Interpretation │ ├── 1678. Goal Parser Interpretation.go │ ├── 1678. Goal Parser Interpretation_test.go │ └── README.md ├── 1679.Max-Number-of-K-Sum-Pairs │ ├── 1679. Max Number of K-Sum Pairs.go │ ├── 1679. Max Number of K-Sum Pairs_test.go │ └── README.md ├── 1680.Concatenation-of-Consecutive-Binary-Numbers │ ├── 1680. Concatenation of Consecutive Binary Numbers.go │ ├── 1680. Concatenation of Consecutive Binary Numbers_test.go │ └── README.md ├── 1681.Minimum-Incompatibility │ ├── 1681. Minimum Incompatibility.go │ ├── 1681. Minimum Incompatibility_test.go │ └── README.md ├── 1684.Count-the-Number-of-Consistent-Strings │ ├── 1684. Count the Number of Consistent Strings.go │ ├── 1684. Count the Number of Consistent Strings_test.go │ └── README.md ├── 1685.Sum-of-Absolute-Differences-in-a-Sorted-Array │ ├── 1685. Sum of Absolute Differences in a Sorted Array.go │ ├── 1685. Sum of Absolute Differences in a Sorted Array_test.go │ └── README.md ├── 1688.Count-of-Matches-in-Tournament │ ├── 1688. Count of Matches in Tournament.go │ ├── 1688. Count of Matches in Tournament_test.go │ └── README.md ├── 1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers │ ├── 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go │ ├── 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers_test.go │ └── README.md ├── 1690.Stone-Game-VII │ ├── 1690. Stone Game VII.go │ ├── 1690. Stone Game VII_test.go │ └── README.md ├── 1691.Maximum-Height-by-Stacking-Cuboids │ ├── 1691. Maximum Height by Stacking Cuboids.go │ ├── 1691. Maximum Height by Stacking Cuboids_test.go │ └── README.md ├── 1694.Reformat-Phone-Number │ ├── 1694. Reformat Phone Number.go │ ├── 1694. Reformat Phone Number_test.go │ └── README.md ├── 1695.Maximum-Erasure-Value │ ├── 1695. Maximum Erasure Value.go │ ├── 1695. Maximum Erasure Value_test.go │ └── README.md ├── 1696.Jump-Game-VI │ ├── 1696. Jump Game VI.go │ ├── 1696. Jump Game VI_test.go │ └── README.md ├── 1700.Number-of-Students-Unable-to-Eat-Lunch │ ├── 1700. Number of Students Unable to Eat Lunch.go │ ├── 1700. Number of Students Unable to Eat Lunch_test.go │ └── README.md ├── 1704.Determine-if-String-Halves-Are-Alike │ ├── 1704. Determine if String Halves Are Alike.go │ ├── 1704. Determine if String Halves Are Alike_test.go │ └── README.md ├── 1705.Maximum-Number-of-Eaten-Apples │ ├── 1705.Maximum Number of Eaten Apples.go │ ├── 1705.Maximum Number of Eaten Apples_test.go │ └── README.md ├── 1710.Maximum-Units-on-a-Truck │ ├── 1710. Maximum Units on a Truck.go │ ├── 1710. Maximum Units on a Truck_test.go │ └── README.md ├── 1716.Calculate-Money-in-Leetcode-Bank │ ├── 1716. Calculate Money in Leetcode Bank.go │ ├── 1716. Calculate Money in Leetcode Bank_test.go │ └── README.md ├── 1720.Decode-XORed-Array │ ├── 1720. Decode XORed Array.go │ ├── 1720. Decode XORed Array_test.go │ └── README.md ├── 1721.Swapping-Nodes-in-a-Linked-List │ ├── 1721. Swapping Nodes in a Linked List.go │ ├── 1721. Swapping Nodes in a Linked List_test.go │ └── README.md ├── 1725.Number-Of-Rectangles-That-Can-Form-The-Largest-Square │ ├── 1725. Number Of Rectangles That Can Form The Largest Square.go │ ├── 1725. Number Of Rectangles That Can Form The Largest Square_test.go │ └── README.md ├── 1732.Find-the-Highest-Altitude │ ├── 1732. Find the Highest Altitude.go │ ├── 1732. Find the Highest Altitude_test.go │ └── README.md ├── 1734.Decode-XORed-Permutation │ ├── 1734. Decode XORed Permutation.go │ ├── 1734. Decode XORed Permutation_test.go │ └── README.md ├── 1736.Latest-Time-by-Replacing-Hidden-Digits │ ├── 1736. Latest Time by Replacing Hidden Digits.go │ ├── 1736. Latest Time by Replacing Hidden Digits_test.go │ └── README.md ├── 1738.Find-Kth-Largest-XOR-Coordinate-Value │ ├── 1738. Find Kth Largest XOR Coordinate Value.go │ ├── 1738. Find Kth Largest XOR Coordinate Value_test.go │ └── README.md ├── 1742.Maximum-Number-of-Balls-in-a-Box │ ├── 1742. Maximum Number of Balls in a Box.go │ ├── 1742. Maximum Number of Balls in a Box_test.go │ └── README.md ├── 1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day │ ├── 1744. Can You Eat Your Favorite Candy on Your Favorite Day.go │ ├── 1744. Can You Eat Your Favorite Candy on Your Favorite Day_test.go │ └── README.md ├── 1748.Sum-of-Unique-Elements │ ├── 1748. Sum of Unique Elements.go │ ├── 1748. Sum of Unique Elements_test.go │ └── README.md ├── 1752.Check-if-Array-Is-Sorted-and-Rotated │ ├── 1752. Check if Array Is Sorted and Rotated.go │ ├── 1752. Check if Array Is Sorted and Rotated_test.go │ └── README.md ├── 1758.Minimum-Changes-To-Make-Alternating-Binary-String │ ├── 1758. Minimum Changes To Make Alternating Binary String.go │ ├── 1758. Minimum Changes To Make Alternating Binary String_test.go │ └── README.md ├── 1763.Longest-Nice-Substring │ ├── 1763. Longest Nice Substring.go │ ├── 1763. Longest Nice Substring_test.go │ └── README.md ├── 1791.Find-Center-of-Star-Graph │ ├── 1791.Find Center of Star Graph.go │ ├── 1791.Find Center of Star Graph_test.go │ └── README.md ├── 1816.Truncate-Sentence │ ├── 1816.Truncate Sentence.go │ ├── 1816.Truncate Sentence_test.go │ └── README.md ├── 1818.Minimum-Absolute-Sum-Difference │ ├── 1818. Minimum Absolute Sum Difference.go │ ├── 1818. Minimum Absolute Sum Difference_test.go │ └── README.md ├── 1846.Maximum-Element-After-Decreasing-and-Rearranging │ ├── 1846. Maximum Element After Decreasing and Rearranging.go │ ├── 1846. Maximum Element After Decreasing and Rearranging_test.go │ └── README.md ├── 1877.Minimize-Maximum-Pair-Sum-in-Array │ ├── 1877. Minimize Maximum Pair Sum in Array.go │ ├── 1877. Minimize Maximum Pair Sum in Array_test.go │ └── README.md ├── 1984.Minimum-Difference-Between-Highest-and-Lowest-of-K-Scores │ ├── 1984.Minimum Difference Between Highest and Lowest of K Scores.go │ ├── 1984.Minimum Difference Between Highest and Lowest of K Scores_test.go │ └── README.md ├── 2021.Brightest-Position-on-Street │ ├── 2021. Brightest Position on Street.go │ ├── 2021. Brightest Position on Street_test.go │ └── README.md ├── 2022.Convert-1D-Array-Into-2D-Array │ ├── 2022. Convert 1D Array Into 2D Array.go │ ├── 2022. Convert 1D Array Into 2D Array_test.go │ └── README.md ├── 2037.Minimum-Number-of-Moves-to-Seat-Everyone │ ├── 2037.Minimum Number of Moves to Seat Everyone.go │ ├── 2037.Minimum Number of Moves to Seat Everyone_test.go │ └── README.md ├── 2038.Remove-Colored-Pieces-if-Both-Neighbors-are-the-Same-Color │ ├── 2038.Remove Colored Pieces if Both Neighbors are the Same Color.go │ ├── 2038.Remove Colored Pieces if Both Neighbors are the Same Color_test.go │ └── README.md ├── 2043.Simple-Bank-System │ ├── 2043.Simple Bank System.go │ ├── 2043.Simple Bank System_test.go │ └── README.md ├── 2096.Step-By-Step-Directions-From-a-Binary-Tree-Node-to-Another │ ├── 2096. Step-By-Step Directions From a Binary Tree Node to Another.go │ ├── 2096. Step-By-Step Directions From a Binary Tree Node to Another_test.go │ └── README.md ├── 2164.Sort-Even-and-Odd-Indices-Independently │ ├── 2164. Sort Even and Odd Indices Independently.go │ ├── 2164. Sort Even and Odd Indices Independently_test.go │ └── README.md ├── 2165.Smallest-Value-of-the-Rearranged-Number │ ├── 2165. Smallest Value of the Rearranged Number.go │ ├── 2165. Smallest Value of the Rearranged Number_test.go │ └── README.md ├── 2166.Design-Bitset │ ├── 2166. Design Bitset.go │ ├── 2166. Design Bitset_test.go │ └── README.md ├── 2167.Minimum-Time-to-Remove-All-Cars-Containing-Illegal-Goods │ ├── 2167. Minimum Time to Remove All Cars Containing Illegal Goods.go │ ├── 2167. Minimum Time to Remove All Cars Containing Illegal Goods_test.go │ └── README.md ├── 2169.Count-Operations-to-Obtain-Zero │ ├── 2169. Count Operations to Obtain Zero.go │ ├── 2169. Count Operations to Obtain Zero_test.go │ └── README.md ├── 2170.Minimum-Operations-to-Make-the-Array-Alternating │ ├── 2170. Minimum Operations to Make the Array Alternating.go │ ├── 2170. Minimum Operations to Make the Array Alternating_test.go │ └── README.md ├── 2171.Removing-Minimum-Number-of-Magic-Beans │ ├── 2171. Removing Minimum Number of Magic Beans.go │ ├── 2171. Removing Minimum Number of Magic Beans_test.go │ └── README.md ├── 2180.Count-Integers-With-Even-Digit-Sum │ ├── 2180. Count Integers With Even Digit Sum.go │ ├── 2180. Count Integers With Even Digit Sum_test.go │ └── README.md ├── 2181.Merge-Nodes-in-Between-Zeros │ ├── 2181. Merge Nodes in Between Zeros.go │ ├── 2181. Merge Nodes in Between Zeros_test.go │ └── README.md ├── 2182.Construct-String-With-Repeat-Limit │ ├── 2182. Construct String With Repeat Limit.go │ ├── 2182. Construct String With Repeat Limit_test.go │ └── README.md ├── 2183.Count-Array-Pairs-Divisible-by-K │ ├── 2183. Count Array Pairs Divisible by K.go │ ├── 2183. Count Array Pairs Divisible by K_test.go │ └── README.md ├── 9990085.Maximal-Rectangle │ ├── 85. Maximal Rectangle.go │ └── 85. Maximal Rectangle_test.go ├── 9990132.Palindrome-Partitioning-II │ ├── 132. Palindrome Partitioning II.go │ └── 132. Palindrome Partitioning II_test.go ├── 9990316.Remove-Duplicate-Letters │ ├── 316. Remove Duplicate Letters.go │ └── 316. Remove Duplicate Letters_test.go ├── 9990352.Data-Stream-as-Disjoint-Intervals │ ├── 352. Data Stream as Disjoint Intervals.go │ └── 352. Data Stream as Disjoint Intervals_test.go ├── 9990363.Max-Sum-of-Rectangle-No-Larger-Than-K │ ├── 363. Max Sum of Rectangle No Larger Than K.go │ └── 363. Max Sum of Rectangle No Larger Than K_test.go ├── 9990975.Odd-Even-Jump │ ├── 975. Odd Even Jump.go │ └── 975. Odd Even Jump_test.go ├── 9991044.Longest-Duplicate-Substring │ ├── 1044. Longest Duplicate Substring.go │ └── 1044. Longest Duplicate Substring_test.go └── 9991292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equal-to-Threshold │ ├── 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold.go │ └── 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_test.go ├── logo.png ├── note ├── grokking_algorithms.md └── time_complexity.md ├── structures ├── Heap.go ├── Heap_test.go ├── Interval.go ├── Interval_test.go ├── ListNode.go ├── ListNode_test.go ├── NestedInteger.go ├── NestedInterger_test.go ├── Point.go ├── Point_test.go ├── PriorityQueue.go ├── PriorityQueue_test.go ├── Queue.go ├── Queue_test.go ├── Stack.go ├── Stack_test.go ├── TreeNode.go ├── TreeNode_test.go ├── go.mod └── go.sum ├── template ├── BIT.go ├── BIT_test.go ├── CLRUCache.go ├── CLRUCache_test.go ├── LFUCache.go ├── LRUCache.go ├── SegmentTree.go ├── UnionFind.go ├── bucket.go ├── go.mod └── go.sum ├── topic ├── Backtracking.png ├── Binary_Indexed_Tree.png ├── Bit_Manipulation.png ├── Linked_List.png ├── Segment_Tree.png ├── Sliding_Window.png ├── Sort.png ├── Stack.png ├── Two_pointers.png └── Union_Find.png └── website ├── archetypes └── default.md ├── config.toml ├── content ├── ChapterFour │ ├── 0001~0099 │ │ ├── 0001.Two-Sum.md │ │ ├── 0002.Add-Two-Numbers.md │ │ ├── 0003.Longest-Substring-Without-Repeating-Characters.md │ │ ├── 0004.Median-of-Two-Sorted-Arrays.md │ │ ├── 0005.Longest-Palindromic-Substring.md │ │ ├── 0006.ZigZag-Conversion.md │ │ ├── 0007.Reverse-Integer.md │ │ ├── 0008.String-to-Integer-atoi.md │ │ ├── 0009.Palindrome-Number.md │ │ ├── 0011.Container-With-Most-Water.md │ │ ├── 0012.Integer-to-Roman.md │ │ ├── 0013.Roman-to-Integer.md │ │ ├── 0014.Longest-Common-Prefix.md │ │ ├── 0015.3Sum.md │ │ ├── 0016.3Sum-Closest.md │ │ ├── 0017.Letter-Combinations-of-a-Phone-Number.md │ │ ├── 0018.4Sum.md │ │ ├── 0019.Remove-Nth-Node-From-End-of-List.md │ │ ├── 0020.Valid-Parentheses.md │ │ ├── 0021.Merge-Two-Sorted-Lists.md │ │ ├── 0022.Generate-Parentheses.md │ │ ├── 0023.Merge-k-Sorted-Lists.md │ │ ├── 0024.Swap-Nodes-in-Pairs.md │ │ ├── 0025.Reverse-Nodes-in-k-Group.md │ │ ├── 0026.Remove-Duplicates-from-Sorted-Array.md │ │ ├── 0027.Remove-Element.md │ │ ├── 0028.Find-the-Index-of-the-First-Occurrence-in-a-String.md │ │ ├── 0029.Divide-Two-Integers.md │ │ ├── 0030.Substring-with-Concatenation-of-All-Words.md │ │ ├── 0031.Next-Permutation.md │ │ ├── 0032.Longest-Valid-Parentheses.md │ │ ├── 0033.Search-in-Rotated-Sorted-Array.md │ │ ├── 0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array.md │ │ ├── 0035.Search-Insert-Position.md │ │ ├── 0036.Valid-Sudoku.md │ │ ├── 0037.Sudoku-Solver.md │ │ ├── 0039.Combination-Sum.md │ │ ├── 0040.Combination-Sum-II.md │ │ ├── 0041.First-Missing-Positive.md │ │ ├── 0042.Trapping-Rain-Water.md │ │ ├── 0043.Multiply-Strings.md │ │ ├── 0045.Jump-Game-II.md │ │ ├── 0046.Permutations.md │ │ ├── 0047.Permutations-II.md │ │ ├── 0048.Rotate-Image.md │ │ ├── 0049.Group-Anagrams.md │ │ ├── 0050.Powx-n.md │ │ ├── 0051.N-Queens.md │ │ ├── 0052.N-Queens-II.md │ │ ├── 0053.Maximum-Subarray.md │ │ ├── 0054.Spiral-Matrix.md │ │ ├── 0055.Jump-Game.md │ │ ├── 0056.Merge-Intervals.md │ │ ├── 0057.Insert-Interval.md │ │ ├── 0058.Length-of-Last-Word.md │ │ ├── 0059.Spiral-Matrix-II.md │ │ ├── 0060.Permutation-Sequence.md │ │ ├── 0061.Rotate-List.md │ │ ├── 0062.Unique-Paths.md │ │ ├── 0063.Unique-Paths-II.md │ │ ├── 0064.Minimum-Path-Sum.md │ │ ├── 0065.Valid-Number.md │ │ ├── 0066.Plus-One.md │ │ ├── 0067.Add-Binary.md │ │ ├── 0069.Sqrtx.md │ │ ├── 0070.Climbing-Stairs.md │ │ ├── 0071.Simplify-Path.md │ │ ├── 0073.Set-Matrix-Zeroes.md │ │ ├── 0074.Search-a-2D-Matrix.md │ │ ├── 0075.Sort-Colors.md │ │ ├── 0076.Minimum-Window-Substring.md │ │ ├── 0077.Combinations.md │ │ ├── 0078.Subsets.md │ │ ├── 0079.Word-Search.md │ │ ├── 0080.Remove-Duplicates-from-Sorted-Array-II.md │ │ ├── 0081.Search-in-Rotated-Sorted-Array-II.md │ │ ├── 0082.Remove-Duplicates-from-Sorted-List-II.md │ │ ├── 0083.Remove-Duplicates-from-Sorted-List.md │ │ ├── 0084.Largest-Rectangle-in-Histogram.md │ │ ├── 0086.Partition-List.md │ │ ├── 0088.Merge-Sorted-Array.md │ │ ├── 0089.Gray-Code.md │ │ ├── 0090.Subsets-II.md │ │ ├── 0091.Decode-Ways.md │ │ ├── 0092.Reverse-Linked-List-II.md │ │ ├── 0093.Restore-IP-Addresses.md │ │ ├── 0094.Binary-Tree-Inorder-Traversal.md │ │ ├── 0095.Unique-Binary-Search-Trees-II.md │ │ ├── 0096.Unique-Binary-Search-Trees.md │ │ ├── 0097.Interleaving-String.md │ │ ├── 0098.Validate-Binary-Search-Tree.md │ │ ├── 0099.Recover-Binary-Search-Tree.md │ │ └── _index.md │ ├── 0100~0199 │ │ ├── 0100.Same-Tree.md │ │ ├── 0101.Symmetric-Tree.md │ │ ├── 0102.Binary-Tree-Level-Order-Traversal.md │ │ ├── 0103.Binary-Tree-Zigzag-Level-Order-Traversal.md │ │ ├── 0104.Maximum-Depth-of-Binary-Tree.md │ │ ├── 0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md │ │ ├── 0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md │ │ ├── 0107.Binary-Tree-Level-Order-Traversal-II.md │ │ ├── 0108.Convert-Sorted-Array-to-Binary-Search-Tree.md │ │ ├── 0109.Convert-Sorted-List-to-Binary-Search-Tree.md │ │ ├── 0110.Balanced-Binary-Tree.md │ │ ├── 0111.Minimum-Depth-of-Binary-Tree.md │ │ ├── 0112.Path-Sum.md │ │ ├── 0113.Path-Sum-II.md │ │ ├── 0114.Flatten-Binary-Tree-to-Linked-List.md │ │ ├── 0115.Distinct-Subsequences.md │ │ ├── 0116.Populating-Next-Right-Pointers-in-Each-Node.md │ │ ├── 0118.Pascals-Triangle.md │ │ ├── 0119.Pascals-Triangle-II.md │ │ ├── 0120.Triangle.md │ │ ├── 0121.Best-Time-to-Buy-and-Sell-Stock.md │ │ ├── 0122.Best-Time-to-Buy-and-Sell-Stock-II.md │ │ ├── 0124.Binary-Tree-Maximum-Path-Sum.md │ │ ├── 0125.Valid-Palindrome.md │ │ ├── 0126.Word-Ladder-II.md │ │ ├── 0127.Word-Ladder.md │ │ ├── 0128.Longest-Consecutive-Sequence.md │ │ ├── 0129.Sum-Root-to-Leaf-Numbers.md │ │ ├── 0130.Surrounded-Regions.md │ │ ├── 0131.Palindrome-Partitioning.md │ │ ├── 0135.Candy.md │ │ ├── 0136.Single-Number.md │ │ ├── 0137.Single-Number-II.md │ │ ├── 0138.Copy-List-With-Random-Pointer.md │ │ ├── 0141.Linked-List-Cycle.md │ │ ├── 0142.Linked-List-Cycle-II.md │ │ ├── 0143.Reorder-List.md │ │ ├── 0144.Binary-Tree-Preorder-Traversal.md │ │ ├── 0145.Binary-Tree-Postorder-Traversal.md │ │ ├── 0146.LRU-Cache.md │ │ ├── 0147.Insertion-Sort-List.md │ │ ├── 0148.Sort-List.md │ │ ├── 0150.Evaluate-Reverse-Polish-Notation.md │ │ ├── 0151.Reverse-Words-in-a-String.md │ │ ├── 0152.Maximum-Product-Subarray.md │ │ ├── 0153.Find-Minimum-in-Rotated-Sorted-Array.md │ │ ├── 0154.Find-Minimum-in-Rotated-Sorted-Array-II.md │ │ ├── 0155.Min-Stack.md │ │ ├── 0160.Intersection-of-Two-Linked-Lists.md │ │ ├── 0162.Find-Peak-Element.md │ │ ├── 0164.Maximum-Gap.md │ │ ├── 0167.Two-Sum-II-Input-array-is-sorted.md │ │ ├── 0168.Excel-Sheet-Column-Title.md │ │ ├── 0169.Majority-Element.md │ │ ├── 0171.Excel-Sheet-Column-Number.md │ │ ├── 0172.Factorial-Trailing-Zeroes.md │ │ ├── 0173.Binary-Search-Tree-Iterator.md │ │ ├── 0174.Dungeon-Game.md │ │ ├── 0179.Largest-Number.md │ │ ├── 0187.Repeated-DNA-Sequences.md │ │ ├── 0189.Rotate-Array.md │ │ ├── 0190.Reverse-Bits.md │ │ ├── 0191.Number-of-1-Bits.md │ │ ├── 0198.House-Robber.md │ │ ├── 0199.Binary-Tree-Right-Side-View.md │ │ └── _index.md │ ├── 0200~0299 │ │ ├── 0200.Number-of-Islands.md │ │ ├── 0201.Bitwise-AND-of-Numbers-Range.md │ │ ├── 0202.Happy-Number.md │ │ ├── 0203.Remove-Linked-List-Elements.md │ │ ├── 0204.Count-Primes.md │ │ ├── 0205.Isomorphic-Strings.md │ │ ├── 0206.Reverse-Linked-List.md │ │ ├── 0207.Course-Schedule.md │ │ ├── 0208.Implement-Trie-Prefix-Tree.md │ │ ├── 0209.Minimum-Size-Subarray-Sum.md │ │ ├── 0210.Course-Schedule-II.md │ │ ├── 0211.Design-Add-and-Search-Words-Data-Structure.md │ │ ├── 0212.Word-Search-II.md │ │ ├── 0213.House-Robber-II.md │ │ ├── 0215.Kth-Largest-Element-in-an-Array.md │ │ ├── 0216.Combination-Sum-III.md │ │ ├── 0217.Contains-Duplicate.md │ │ ├── 0218.The-Skyline-Problem.md │ │ ├── 0219.Contains-Duplicate-II.md │ │ ├── 0220.Contains-Duplicate-III.md │ │ ├── 0222.Count-Complete-Tree-Nodes.md │ │ ├── 0223.Rectangle-Area.md │ │ ├── 0224.Basic-Calculator.md │ │ ├── 0225.Implement-Stack-using-Queues.md │ │ ├── 0226.Invert-Binary-Tree.md │ │ ├── 0227.Basic-Calculator-II.md │ │ ├── 0228.Summary-Ranges.md │ │ ├── 0229.Majority-Element-II.md │ │ ├── 0230.Kth-Smallest-Element-in-a-BST.md │ │ ├── 0231.Power-of-Two.md │ │ ├── 0232.Implement-Queue-using-Stacks.md │ │ ├── 0234.Palindrome-Linked-List.md │ │ ├── 0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md │ │ ├── 0236.Lowest-Common-Ancestor-of-a-Binary-Tree.md │ │ ├── 0237.Delete-Node-in-a-Linked-List.md │ │ ├── 0239.Sliding-Window-Maximum.md │ │ ├── 0240.Search-a-2D-Matrix-II.md │ │ ├── 0242.Valid-Anagram.md │ │ ├── 0257.Binary-Tree-Paths.md │ │ ├── 0258.Add-Digits.md │ │ ├── 0260.Single-Number-III.md │ │ ├── 0263.Ugly-Number.md │ │ ├── 0264.Ugly-Number-II.md │ │ ├── 0268.Missing-Number.md │ │ ├── 0274.H-Index.md │ │ ├── 0275.H-Index-II.md │ │ ├── 0278.First-Bad-Version.md │ │ ├── 0279.Perfect-Squares.md │ │ ├── 0283.Move-Zeroes.md │ │ ├── 0284.Peeking-Iterator.md │ │ ├── 0287.Find-the-Duplicate-Number.md │ │ ├── 0290.Word-Pattern.md │ │ ├── 0297.Serialize-and-Deserialize-Binary-Tree.md │ │ ├── 0299.Bulls-and-Cows.md │ │ └── _index.md │ ├── 0300~0399 │ │ ├── 0300.Longest-Increasing-Subsequence.md │ │ ├── 0301.Remove-Invalid-Parentheses.md │ │ ├── 0303.Range-Sum-Query-Immutable.md │ │ ├── 0304.Range-Sum-Query-2D-Immutable.md │ │ ├── 0306.Additive-Number.md │ │ ├── 0307.Range-Sum-Query-Mutable.md │ │ ├── 0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown.md │ │ ├── 0315.Count-of-Smaller-Numbers-After-Self.md │ │ ├── 0318.Maximum-Product-of-Word-Lengths.md │ │ ├── 0319.Bulb-Switcher.md │ │ ├── 0322.Coin-Change.md │ │ ├── 0324.Wiggle-Sort-II.md │ │ ├── 0326.Power-of-Three.md │ │ ├── 0327.Count-of-Range-Sum.md │ │ ├── 0328.Odd-Even-Linked-List.md │ │ ├── 0329.Longest-Increasing-Path-in-a-Matrix.md │ │ ├── 0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md │ │ ├── 0337.House-Robber-III.md │ │ ├── 0338.Counting-Bits.md │ │ ├── 0341.Flatten-Nested-List-Iterator.md │ │ ├── 0342.Power-of-Four.md │ │ ├── 0343.Integer-Break.md │ │ ├── 0344.Reverse-String.md │ │ ├── 0345.Reverse-Vowels-of-a-String.md │ │ ├── 0347.Top-K-Frequent-Elements.md │ │ ├── 0349.Intersection-of-Two-Arrays.md │ │ ├── 0350.Intersection-of-Two-Arrays-II.md │ │ ├── 0352.Data-Stream-as-Disjoint-Intervals.md │ │ ├── 0354.Russian-Doll-Envelopes.md │ │ ├── 0357.Count-Numbers-with-Unique-Digits.md │ │ ├── 0367.Valid-Perfect-Square.md │ │ ├── 0368.Largest-Divisible-Subset.md │ │ ├── 0371.Sum-of-Two-Integers.md │ │ ├── 0372.Super-Pow.md │ │ ├── 0373.Find-K-Pairs-with-Smallest-Sums.md │ │ ├── 0374.Guess-Number-Higher-or-Lower.md │ │ ├── 0376.Wiggle-Subsequence.md │ │ ├── 0377.Combination-Sum-IV.md │ │ ├── 0378.Kth-Smallest-Element-in-a-Sorted-Matrix.md │ │ ├── 0382.Linked-List-Random-Node.md │ │ ├── 0383.Ransom-Note.md │ │ ├── 0384.Shuffle-an-Array.md │ │ ├── 0385.Mini-Parser.md │ │ ├── 0386.Lexicographical-Numbers.md │ │ ├── 0387.First-Unique-Character-in-a-String.md │ │ ├── 0389.Find-the-Difference.md │ │ ├── 0390.Elimination-Game.md │ │ ├── 0391.Perfect-Rectangle.md │ │ ├── 0392.Is-Subsequence.md │ │ ├── 0393.UTF-8-Validation.md │ │ ├── 0394.Decode-String.md │ │ ├── 0395.Longest-Substring-with-At-Least-K-Repeating-Characters.md │ │ ├── 0396.Rotate-Function.md │ │ ├── 0397.Integer-Replacement.md │ │ ├── 0399.Evaluate-Division.md │ │ └── _index.md │ ├── 0400~0499 │ │ ├── 0400.Nth-Digit.md │ │ ├── 0401.Binary-Watch.md │ │ ├── 0402.Remove-K-Digits.md │ │ ├── 0404.Sum-of-Left-Leaves.md │ │ ├── 0405.Convert-a-Number-to-Hexadecimal.md │ │ ├── 0409.Longest-Palindrome.md │ │ ├── 0410.Split-Array-Largest-Sum.md │ │ ├── 0412.Fizz-Buzz.md │ │ ├── 0413.Arithmetic-Slices.md │ │ ├── 0414.Third-Maximum-Number.md │ │ ├── 0416.Partition-Equal-Subset-Sum.md │ │ ├── 0417.Pacific-Atlantic-Water-Flow.md │ │ ├── 0419.Battleships-in-a-Board.md │ │ ├── 0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md │ │ ├── 0423.Reconstruct-Original-Digits-from-English.md │ │ ├── 0424.Longest-Repeating-Character-Replacement.md │ │ ├── 0429.N-ary-Tree-Level-Order-Traversal.md │ │ ├── 0433.Minimum-Genetic-Mutation.md │ │ ├── 0434.Number-of-Segments-in-a-String.md │ │ ├── 0435.Non-overlapping-Intervals.md │ │ ├── 0436.Find-Right-Interval.md │ │ ├── 0437.Path-Sum-III.md │ │ ├── 0438.Find-All-Anagrams-in-a-String.md │ │ ├── 0441.Arranging-Coins.md │ │ ├── 0445.Add-Two-Numbers-II.md │ │ ├── 0447.Number-of-Boomerangs.md │ │ ├── 0448.Find-All-Numbers-Disappeared-in-an-Array.md │ │ ├── 0451.Sort-Characters-By-Frequency.md │ │ ├── 0453.Minimum-Moves-to-Equal-Array-Elements.md │ │ ├── 0454.4Sum-II.md │ │ ├── 0455.Assign-Cookies.md │ │ ├── 0456.132-Pattern.md │ │ ├── 0457.Circular-Array-Loop.md │ │ ├── 0458.Poor-Pigs.md │ │ ├── 0460.LFU-Cache.md │ │ ├── 0461.Hamming-Distance.md │ │ ├── 0462.Minimum-Moves-to-Equal-Array-Elements-II.md │ │ ├── 0463.Island-Perimeter.md │ │ ├── 0470.Implement-Rand10-Using-Rand7.md │ │ ├── 0473.Matchsticks-to-Square.md │ │ ├── 0474.Ones-and-Zeroes.md │ │ ├── 0475.Heaters.md │ │ ├── 0476.Number-Complement.md │ │ ├── 0477.Total-Hamming-Distance.md │ │ ├── 0478.Generate-Random-Point-in-a-Circle.md │ │ ├── 0480.Sliding-Window-Median.md │ │ ├── 0483.Smallest-Good-Base.md │ │ ├── 0485.Max-Consecutive-Ones.md │ │ ├── 0488.Zuma-Game.md │ │ ├── 0491.Non-decreasing-Subsequences.md │ │ ├── 0492.Construct-the-Rectangle.md │ │ ├── 0493.Reverse-Pairs.md │ │ ├── 0494.Target-Sum.md │ │ ├── 0495.Teemo-Attacking.md │ │ ├── 0496.Next-Greater-Element-I.md │ │ ├── 0497.Random-Point-in-Non-overlapping-Rectangles.md │ │ ├── 0498.Diagonal-Traverse.md │ │ └── _index.md │ ├── 0500~0599 │ │ ├── 0500.Keyboard-Row.md │ │ ├── 0503.Next-Greater-Element-II.md │ │ ├── 0504.Base-7.md │ │ ├── 0506.Relative-Ranks.md │ │ ├── 0507.Perfect-Number.md │ │ ├── 0508.Most-Frequent-Subtree-Sum.md │ │ ├── 0509.Fibonacci-Number.md │ │ ├── 0513.Find-Bottom-Left-Tree-Value.md │ │ ├── 0515.Find-Largest-Value-in-Each-Tree-Row.md │ │ ├── 0518.Coin-Change-II.md │ │ ├── 0519.Random-Flip-Matrix.md │ │ ├── 0520.Detect-Capital.md │ │ ├── 0523.Continuous-Subarray-Sum.md │ │ ├── 0524.Longest-Word-in-Dictionary-through-Deleting.md │ │ ├── 0525.Contiguous-Array.md │ │ ├── 0526.Beautiful-Arrangement.md │ │ ├── 0528.Random-Pick-with-Weight.md │ │ ├── 0529.Minesweeper.md │ │ ├── 0530.Minimum-Absolute-Difference-in-BST.md │ │ ├── 0532.K-diff-Pairs-in-an-Array.md │ │ ├── 0535.Encode-and-Decode-TinyURL.md │ │ ├── 0537.Complex-Number-Multiplication.md │ │ ├── 0538.Convert-BST-to-Greater-Tree.md │ │ ├── 0540.Single-Element-in-a-Sorted-Array.md │ │ ├── 0541.Reverse-String-II.md │ │ ├── 0542.01-Matrix.md │ │ ├── 0543.Diameter-of-Binary-Tree.md │ │ ├── 0547.Number-of-Provinces.md │ │ ├── 0551.Student-Attendance-Record-I.md │ │ ├── 0554.Brick-Wall.md │ │ ├── 0557.Reverse-Words-in-a-String-III.md │ │ ├── 0559.Maximum-Depth-of-N-ary-Tree.md │ │ ├── 0560.Subarray-Sum-Equals-K.md │ │ ├── 0561.Array-Partition.md │ │ ├── 0563.Binary-Tree-Tilt.md │ │ ├── 0566.Reshape-the-Matrix.md │ │ ├── 0567.Permutation-in-String.md │ │ ├── 0572.Subtree-of-Another-Tree.md │ │ ├── 0575.Distribute-Candies.md │ │ ├── 0576.Out-of-Boundary-Paths.md │ │ ├── 0581.Shortest-Unsorted-Continuous-Subarray.md │ │ ├── 0583.Delete-Operation-for-Two-Strings.md │ │ ├── 0589.N-ary-Tree-Preorder-Traversal.md │ │ ├── 0594.Longest-Harmonious-Subsequence.md │ │ ├── 0598.Range-Addition-II.md │ │ ├── 0599.Minimum-Index-Sum-of-Two-Lists.md │ │ └── _index.md │ ├── 0600~0699 │ │ ├── 0605.Can-Place-Flowers.md │ │ ├── 0609.Find-Duplicate-File-in-System.md │ │ ├── 0611.Valid-Triangle-Number.md │ │ ├── 0617.Merge-Two-Binary-Trees.md │ │ ├── 0622.Design-Circular-Queue.md │ │ ├── 0623.Add-One-Row-to-Tree.md │ │ ├── 0628.Maximum-Product-of-Three-Numbers.md │ │ ├── 0630.Course-Schedule-III.md │ │ ├── 0632.Smallest-Range-Covering-Elements-from-K-Lists.md │ │ ├── 0633.Sum-of-Square-Numbers.md │ │ ├── 0636.Exclusive-Time-of-Functions.md │ │ ├── 0637.Average-of-Levels-in-Binary-Tree.md │ │ ├── 0638.Shopping-Offers.md │ │ ├── 0643.Maximum-Average-Subarray-I.md │ │ ├── 0645.Set-Mismatch.md │ │ ├── 0647.Palindromic-Substrings.md │ │ ├── 0648.Replace-Words.md │ │ ├── 0653.Two-Sum-IV-Input-is-a-BST.md │ │ ├── 0658.Find-K-Closest-Elements.md │ │ ├── 0661.Image-Smoother.md │ │ ├── 0662.Maximum-Width-of-Binary-Tree.md │ │ ├── 0665.Non-decreasing-Array.md │ │ ├── 0667.Beautiful-Arrangement-II.md │ │ ├── 0668.Kth-Smallest-Number-in-Multiplication-Table.md │ │ ├── 0669.Trim-a-Binary-Search-Tree.md │ │ ├── 0674.Longest-Continuous-Increasing-Subsequence.md │ │ ├── 0676.Implement-Magic-Dictionary.md │ │ ├── 0677.Map-Sum-Pairs.md │ │ ├── 0682.Baseball-Game.md │ │ ├── 0684.Redundant-Connection.md │ │ ├── 0685.Redundant-Connection-II.md │ │ ├── 0690.Employee-Importance.md │ │ ├── 0692.Top-K-Frequent-Words.md │ │ ├── 0693.Binary-Number-with-Alternating-Bits.md │ │ ├── 0695.Max-Area-of-Island.md │ │ ├── 0696.Count-Binary-Substrings.md │ │ ├── 0697.Degree-of-an-Array.md │ │ ├── 0699.Falling-Squares.md │ │ └── _index.md │ ├── 0700~0799 │ │ ├── 0700.Search-in-a-Binary-Search-Tree.md │ │ ├── 0701.Insert-into-a-Binary-Search-Tree.md │ │ ├── 0703.Kth-Largest-Element-in-a-Stream.md │ │ ├── 0704.Binary-Search.md │ │ ├── 0705.Design-HashSet.md │ │ ├── 0706.Design-HashMap.md │ │ ├── 0707.Design-Linked-List.md │ │ ├── 0709.To-Lower-Case.md │ │ ├── 0710.Random-Pick-with-Blacklist.md │ │ ├── 0713.Subarray-Product-Less-Than-K.md │ │ ├── 0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md │ │ ├── 0715.Range-Module.md │ │ ├── 0717.1-bit-and-2-bit-Characters.md │ │ ├── 0718.Maximum-Length-of-Repeated-Subarray.md │ │ ├── 0719.Find-K-th-Smallest-Pair-Distance.md │ │ ├── 0720.Longest-Word-in-Dictionary.md │ │ ├── 0721.Accounts-Merge.md │ │ ├── 0724.Find-Pivot-Index.md │ │ ├── 0725.Split-Linked-List-in-Parts.md │ │ ├── 0726.Number-of-Atoms.md │ │ ├── 0728.Self-Dividing-Numbers.md │ │ ├── 0729.My-Calendar-I.md │ │ ├── 0732.My-Calendar-III.md │ │ ├── 0733.Flood-Fill.md │ │ ├── 0735.Asteroid-Collision.md │ │ ├── 0739.Daily-Temperatures.md │ │ ├── 0744.Find-Smallest-Letter-Greater-Than-Target.md │ │ ├── 0745.Prefix-and-Suffix-Search.md │ │ ├── 0746.Min-Cost-Climbing-Stairs.md │ │ ├── 0747.Largest-Number-At-Least-Twice-of-Others.md │ │ ├── 0748.Shortest-Completing-Word.md │ │ ├── 0752.Open-the-Lock.md │ │ ├── 0753.Cracking-the-Safe.md │ │ ├── 0756.Pyramid-Transition-Matrix.md │ │ ├── 0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md │ │ ├── 0763.Partition-Labels.md │ │ ├── 0765.Couples-Holding-Hands.md │ │ ├── 0766.Toeplitz-Matrix.md │ │ ├── 0767.Reorganize-String.md │ │ ├── 0771.Jewels-and-Stones.md │ │ ├── 0775.Global-and-Local-Inversions.md │ │ ├── 0778.Swim-in-Rising-Water.md │ │ ├── 0781.Rabbits-in-Forest.md │ │ ├── 0783.Minimum-Distance-Between-BST-Nodes.md │ │ ├── 0784.Letter-Case-Permutation.md │ │ ├── 0785.Is-Graph-Bipartite.md │ │ ├── 0786.K-th-Smallest-Prime-Fraction.md │ │ ├── 0791.Custom-Sort-String.md │ │ ├── 0792.Number-of-Matching-Subsequences.md │ │ ├── 0793.Preimage-Size-of-Factorial-Zeroes-Function.md │ │ ├── 0794.Valid-Tic-Tac-Toe-State.md │ │ ├── 0795.Number-of-Subarrays-with-Bounded-Maximum.md │ │ └── _index.md │ ├── 0800~0899 │ │ ├── 0802.Find-Eventual-Safe-States.md │ │ ├── 0803.Bricks-Falling-When-Hit.md │ │ ├── 0807.Max-Increase-to-Keep-City-Skyline.md │ │ ├── 0810.Chalkboard-XOR-Game.md │ │ ├── 0811.Subdomain-Visit-Count.md │ │ ├── 0812.Largest-Triangle-Area.md │ │ ├── 0815.Bus-Routes.md │ │ ├── 0816.Ambiguous-Coordinates.md │ │ ├── 0817.Linked-List-Components.md │ │ ├── 0819.Most-Common-Word.md │ │ ├── 0820.Short-Encoding-of-Words.md │ │ ├── 0821.Shortest-Distance-to-a-Character.md │ │ ├── 0823.Binary-Trees-With-Factors.md │ │ ├── 0825.Friends-Of-Appropriate-Ages.md │ │ ├── 0826.Most-Profit-Assigning-Work.md │ │ ├── 0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md │ │ ├── 0830.Positions-of-Large-Groups.md │ │ ├── 0832.Flipping-an-Image.md │ │ ├── 0834.Sum-of-Distances-in-Tree.md │ │ ├── 0836.Rectangle-Overlap.md │ │ ├── 0838.Push-Dominoes.md │ │ ├── 0839.Similar-String-Groups.md │ │ ├── 0841.Keys-and-Rooms.md │ │ ├── 0842.Split-Array-into-Fibonacci-Sequence.md │ │ ├── 0844.Backspace-String-Compare.md │ │ ├── 0845.Longest-Mountain-in-Array.md │ │ ├── 0846.Hand-of-Straights.md │ │ ├── 0850.Rectangle-Area-II.md │ │ ├── 0851.Loud-and-Rich.md │ │ ├── 0852.Peak-Index-in-a-Mountain-Array.md │ │ ├── 0853.Car-Fleet.md │ │ ├── 0856.Score-of-Parentheses.md │ │ ├── 0859.Buddy-Strings.md │ │ ├── 0862.Shortest-Subarray-with-Sum-at-Least-K.md │ │ ├── 0863.All-Nodes-Distance-K-in-Binary-Tree.md │ │ ├── 0864.Shortest-Path-to-Get-All-Keys.md │ │ ├── 0867.Transpose-Matrix.md │ │ ├── 0869.Reordered-Power-of-2.md │ │ ├── 0870.Advantage-Shuffle.md │ │ ├── 0872.Leaf-Similar-Trees.md │ │ ├── 0874.Walking-Robot-Simulation.md │ │ ├── 0875.Koko-Eating-Bananas.md │ │ ├── 0876.Middle-of-the-Linked-List.md │ │ ├── 0877.Stone-Game.md │ │ ├── 0878.Nth-Magical-Number.md │ │ ├── 0880.Decoded-String-at-Index.md │ │ ├── 0881.Boats-to-Save-People.md │ │ ├── 0884.Uncommon-Words-from-Two-Sentences.md │ │ ├── 0885.Spiral-Matrix-III.md │ │ ├── 0887.Super-Egg-Drop.md │ │ ├── 0888.Fair-Candy-Swap.md │ │ ├── 0890.Find-and-Replace-Pattern.md │ │ ├── 0891.Sum-of-Subsequence-Widths.md │ │ ├── 0892.Surface-Area-of-3D-Shapes.md │ │ ├── 0895.Maximum-Frequency-Stack.md │ │ ├── 0896.Monotonic-Array.md │ │ ├── 0897.Increasing-Order-Search-Tree.md │ │ ├── 0898.Bitwise-ORs-of-Subarrays.md │ │ └── _index.md │ ├── 0900~0999 │ │ ├── 0901.Online-Stock-Span.md │ │ ├── 0904.Fruit-Into-Baskets.md │ │ ├── 0907.Sum-of-Subarray-Minimums.md │ │ ├── 0909.Snakes-and-Ladders.md │ │ ├── 0910.Smallest-Range-II.md │ │ ├── 0911.Online-Election.md │ │ ├── 0914.X-of-a-Kind-in-a-Deck-of-Cards.md │ │ ├── 0916.Word-Subsets.md │ │ ├── 0918.Maximum-Sum-Circular-Subarray.md │ │ ├── 0920.Number-of-Music-Playlists.md │ │ ├── 0921.Minimum-Add-to-Make-Parentheses-Valid.md │ │ ├── 0922.Sort-Array-By-Parity-II.md │ │ ├── 0923.3Sum-With-Multiplicity.md │ │ ├── 0924.Minimize-Malware-Spread.md │ │ ├── 0925.Long-Pressed-Name.md │ │ ├── 0927.Three-Equal-Parts.md │ │ ├── 0928.Minimize-Malware-Spread-II.md │ │ ├── 0930.Binary-Subarrays-With-Sum.md │ │ ├── 0933.Number-of-Recent-Calls.md │ │ ├── 0938.Range-Sum-of-BST.md │ │ ├── 0942.DI-String-Match.md │ │ ├── 0946.Validate-Stack-Sequences.md │ │ ├── 0947.Most-Stones-Removed-with-Same-Row-or-Column.md │ │ ├── 0949.Largest-Time-for-Given-Digits.md │ │ ├── 0952.Largest-Component-Size-by-Common-Factor.md │ │ ├── 0953.Verifying-an-Alien-Dictionary.md │ │ ├── 0958.Check-Completeness-of-a-Binary-Tree.md │ │ ├── 0959.Regions-Cut-By-Slashes.md │ │ ├── 0961.N-Repeated-Element-in-Size-2N-Array.md │ │ ├── 0966.Vowel-Spellchecker.md │ │ ├── 0968.Binary-Tree-Cameras.md │ │ ├── 0969.Pancake-Sorting.md │ │ ├── 0970.Powerful-Integers.md │ │ ├── 0971.Flip-Binary-Tree-To-Match-Preorder-Traversal.md │ │ ├── 0973.K-Closest-Points-to-Origin.md │ │ ├── 0976.Largest-Perimeter-Triangle.md │ │ ├── 0977.Squares-of-a-Sorted-Array.md │ │ ├── 0978.Longest-Turbulent-Subarray.md │ │ ├── 0979.Distribute-Coins-in-Binary-Tree.md │ │ ├── 0980.Unique-Paths-III.md │ │ ├── 0981.Time-Based-Key-Value-Store.md │ │ ├── 0984.String-Without-AAA-or-BBB.md │ │ ├── 0985.Sum-of-Even-Numbers-After-Queries.md │ │ ├── 0986.Interval-List-Intersections.md │ │ ├── 0987.Vertical-Order-Traversal-of-a-Binary-Tree.md │ │ ├── 0989.Add-to-Array-Form-of-Integer.md │ │ ├── 0990.Satisfiability-of-Equality-Equations.md │ │ ├── 0991.Broken-Calculator.md │ │ ├── 0992.Subarrays-with-K-Different-Integers.md │ │ ├── 0993.Cousins-in-Binary-Tree.md │ │ ├── 0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md │ │ ├── 0996.Number-of-Squareful-Arrays.md │ │ ├── 0997.Find-the-Town-Judge.md │ │ ├── 0999.Available-Captures-for-Rook.md │ │ └── _index.md │ ├── 1000~1099 │ │ ├── 1002.Find-Common-Characters.md │ │ ├── 1003.Check-If-Word-Is-Valid-After-Substitutions.md │ │ ├── 1004.Max-Consecutive-Ones-III.md │ │ ├── 1005.Maximize-Sum-Of-Array-After-K-Negations.md │ │ ├── 1006.Clumsy-Factorial.md │ │ ├── 1009.Complement-of-Base-10-Integer.md │ │ ├── 1010.Pairs-of-Songs-With-Total-Durations-Divisible-by-60.md │ │ ├── 1011.Capacity-To-Ship-Packages-Within-D-Days.md │ │ ├── 1017.Convert-to-Base-2.md │ │ ├── 1018.Binary-Prefix-Divisible-By-5.md │ │ ├── 1019.Next-Greater-Node-In-Linked-List.md │ │ ├── 1020.Number-of-Enclaves.md │ │ ├── 1021.Remove-Outermost-Parentheses.md │ │ ├── 1022.Sum-of-Root-To-Leaf-Binary-Numbers.md │ │ ├── 1025.Divisor-Game.md │ │ ├── 1026.Maximum-Difference-Between-Node-and-Ancestor.md │ │ ├── 1028.Recover-a-Tree-From-Preorder-Traversal.md │ │ ├── 1030.Matrix-Cells-in-Distance-Order.md │ │ ├── 1034.Coloring-A-Border.md │ │ ├── 1037.Valid-Boomerang.md │ │ ├── 1038.Binary-Search-Tree-to-Greater-Sum-Tree.md │ │ ├── 1040.Moving-Stones-Until-Consecutive-II.md │ │ ├── 1047.Remove-All-Adjacent-Duplicates-In-String.md │ │ ├── 1048.Longest-String-Chain.md │ │ ├── 1049.Last-Stone-Weight-II.md │ │ ├── 1051.Height-Checker.md │ │ ├── 1052.Grumpy-Bookstore-Owner.md │ │ ├── 1054.Distant-Barcodes.md │ │ ├── 1073.Adding-Two-Negabinary-Numbers.md │ │ ├── 1074.Number-of-Submatrices-That-Sum-to-Target.md │ │ ├── 1078.Occurrences-After-Bigram.md │ │ ├── 1079.Letter-Tile-Possibilities.md │ │ ├── 1089.Duplicate-Zeros.md │ │ ├── 1091.Shortest-Path-in-Binary-Matrix.md │ │ ├── 1093.Statistics-from-a-Large-Sample.md │ │ └── _index.md │ ├── 1100~1199 │ │ ├── 1104.Path-In-Zigzag-Labelled-Binary-Tree.md │ │ ├── 1105.Filling-Bookcase-Shelves.md │ │ ├── 1108.Defanging-an-IP-Address.md │ │ ├── 1110.Delete-Nodes-And-Return-Forest.md │ │ ├── 1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md │ │ ├── 1122.Relative-Sort-Array.md │ │ ├── 1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md │ │ ├── 1128.Number-of-Equivalent-Domino-Pairs.md │ │ ├── 1137.N-th-Tribonacci-Number.md │ │ ├── 1143.Longest-Common-Subsequence.md │ │ ├── 1145.Binary-Tree-Coloring-Game.md │ │ ├── 1154.Day-of-the-Year.md │ │ ├── 1157.Online-Majority-Element-In-Subarray.md │ │ ├── 1160.Find-Words-That-Can-Be-Formed-by-Characters.md │ │ ├── 1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md │ │ ├── 1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List.md │ │ ├── 1175.Prime-Arrangements.md │ │ ├── 1178.Number-of-Valid-Words-for-Each-Puzzle.md │ │ ├── 1184.Distance-Between-Bus-Stops.md │ │ ├── 1185.Day-of-the-Week.md │ │ ├── 1189.Maximum-Number-of-Balloons.md │ │ ├── 1190.Reverse-Substrings-Between-Each-Pair-of-Parentheses.md │ │ └── _index.md │ ├── 1200~1299 │ │ ├── 1200.Minimum-Absolute-Difference.md │ │ ├── 1201.Ugly-Number-III.md │ │ ├── 1202.Smallest-String-With-Swaps.md │ │ ├── 1203.Sort-Items-by-Groups-Respecting-Dependencies.md │ │ ├── 1207.Unique-Number-of-Occurrences.md │ │ ├── 1208.Get-Equal-Substrings-Within-Budget.md │ │ ├── 1209.Remove-All-Adjacent-Duplicates-in-String-II.md │ │ ├── 1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md │ │ ├── 1221.Split-a-String-in-Balanced-Strings.md │ │ ├── 1232.Check-If-It-Is-a-Straight-Line.md │ │ ├── 1234.Replace-the-Substring-for-Balanced-String.md │ │ ├── 1235.Maximum-Profit-in-Job-Scheduling.md │ │ ├── 1239.Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.md │ │ ├── 1249.Minimum-Remove-to-Make-Valid-Parentheses.md │ │ ├── 1252.Cells-with-Odd-Values-in-a-Matrix.md │ │ ├── 1254.Number-of-Closed-Islands.md │ │ ├── 1260.Shift-2D-Grid.md │ │ ├── 1266.Minimum-Time-Visiting-All-Points.md │ │ ├── 1268.Search-Suggestions-System.md │ │ ├── 1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md │ │ ├── 1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer.md │ │ ├── 1283.Find-the-Smallest-Divisor-Given-a-Threshold.md │ │ ├── 1287.Element-Appearing-More-Than-25-In-Sorted-Array.md │ │ ├── 1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md │ │ ├── 1293.Shortest-Path-in-a-Grid-with-Obstacles-Elimination.md │ │ ├── 1295.Find-Numbers-with-Even-Number-of-Digits.md │ │ ├── 1296.Divide-Array-in-Sets-of-K-Consecutive-Numbers.md │ │ ├── 1299.Replace-Elements-with-Greatest-Element-on-Right-Side.md │ │ └── _index.md │ ├── 1300~1399 │ │ ├── 1300.Sum-of-Mutated-Array-Closest-to-Target.md │ │ ├── 1302.Deepest-Leaves-Sum.md │ │ ├── 1304.Find-N-Unique-Integers-Sum-up-to-Zero.md │ │ ├── 1305.All-Elements-in-Two-Binary-Search-Trees.md │ │ ├── 1306.Jump-Game-III.md │ │ ├── 1310.XOR-Queries-of-a-Subarray.md │ │ ├── 1313.Decompress-Run-Length-Encoded-List.md │ │ ├── 1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers.md │ │ ├── 1319.Number-of-Operations-to-Make-Network-Connected.md │ │ ├── 1329.Sort-the-Matrix-Diagonally.md │ │ ├── 1332.Remove-Palindromic-Subsequences.md │ │ ├── 1337.The-K-Weakest-Rows-in-a-Matrix.md │ │ ├── 1353.Maximum-Number-of-Events-That-Can-Be-Attended.md │ │ ├── 1380.Lucky-Numbers-in-a-Matrix.md │ │ ├── 1383.Maximum-Performance-of-a-Team.md │ │ ├── 1385.Find-the-Distance-Value-Between-Two-Arrays.md │ │ ├── 1389.Create-Target-Array-in-the-Given-Order.md │ │ ├── 1396.Design-Underground-System.md │ │ └── _index.md │ ├── 1400~1499 │ │ ├── 1423.Maximum-Points-You-Can-Obtain-from-Cards.md │ │ ├── 1437.Check-If-All-1s-Are-at-Least-Length-K-Places-Away.md │ │ ├── 1438.Longest-Continuous-Subarray-With-Absolute-Diff-Less-Than-or-Equal-to-Limit.md │ │ ├── 1439.Find-the-Kth-Smallest-Sum-of-a-Matrix-With-Sorted-Rows.md │ │ ├── 1442.Count-Triplets-That-Can-Form-Two-Arrays-of-Equal-XOR.md │ │ ├── 1446.Consecutive-Characters.md │ │ ├── 1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md │ │ ├── 1461.Check-If-a-String-Contains-All-Binary-Codes-of-Size-K.md │ │ ├── 1463.Cherry-Pickup-II.md │ │ ├── 1464.Maximum-Product-of-Two-Elements-in-an-Array.md │ │ ├── 1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts.md │ │ ├── 1470.Shuffle-the-Array.md │ │ ├── 1480.Running-Sum-of-1d-Array.md │ │ ├── 1482.Minimum-Number-of-Days-to-Make-m-Bouquets.md │ │ ├── 1486.XOR-Operation-in-an-Array.md │ │ └── _index.md │ ├── 1500~1599 │ │ ├── 1512.Number-of-Good-Pairs.md │ │ ├── 1518.Water-Bottles.md │ │ ├── 1539.Kth-Missing-Positive-Number.md │ │ ├── 1551.Minimum-Operations-to-Make-Array-Equal.md │ │ ├── 1572.Matrix-Diagonal-Sum.md │ │ ├── 1573.Number-of-Ways-to-Split-a-String.md │ │ ├── 1576.Replace-All-s-to-Avoid-Consecutive-Repeating-Characters.md │ │ ├── 1579.Remove-Max-Number-of-Edges-to-Keep-Graph-Fully-Traversable.md │ │ └── _index.md │ ├── 1600~1699 │ │ ├── 1600.Throne-Inheritance.md │ │ ├── 1603.Design-Parking-System.md │ │ ├── 1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X.md │ │ ├── 1609.Even-Odd-Tree.md │ │ ├── 1614.Maximum-Nesting-Depth-of-the-Parentheses.md │ │ ├── 1619.Mean-of-Array-After-Removing-Some-Elements.md │ │ ├── 1624.Largest-Substring-Between-Two-Equal-Characters.md │ │ ├── 1629.Slowest-Key.md │ │ ├── 1631.Path-With-Minimum-Effort.md │ │ ├── 1636.Sort-Array-by-Increasing-Frequency.md │ │ ├── 1640.Check-Array-Formation-Through-Concatenation.md │ │ ├── 1641.Count-Sorted-Vowel-Strings.md │ │ ├── 1642.Furthest-Building-You-Can-Reach.md │ │ ├── 1646.Get-Maximum-in-Generated-Array.md │ │ ├── 1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md │ │ ├── 1648.Sell-Diminishing-Valued-Colored-Balls.md │ │ ├── 1649.Create-Sorted-Array-through-Instructions.md │ │ ├── 1652.Defuse-the-Bomb.md │ │ ├── 1653.Minimum-Deletions-to-Make-String-Balanced.md │ │ ├── 1654.Minimum-Jumps-to-Reach-Home.md │ │ ├── 1655.Distribute-Repeating-Integers.md │ │ ├── 1656.Design-an-Ordered-Stream.md │ │ ├── 1657.Determine-if-Two-Strings-Are-Close.md │ │ ├── 1658.Minimum-Operations-to-Reduce-X-to-Zero.md │ │ ├── 1659.Maximize-Grid-Happiness.md │ │ ├── 1662.Check-If-Two-String-Arrays-are-Equivalent.md │ │ ├── 1663.Smallest-String-With-A-Given-Numeric-Value.md │ │ ├── 1664.Ways-to-Make-a-Fair-Array.md │ │ ├── 1665.Minimum-Initial-Energy-to-Finish-Tasks.md │ │ ├── 1668.Maximum-Repeating-Substring.md │ │ ├── 1669.Merge-In-Between-Linked-Lists.md │ │ ├── 1670.Design-Front-Middle-Back-Queue.md │ │ ├── 1672.Richest-Customer-Wealth.md │ │ ├── 1673.Find-the-Most-Competitive-Subsequence.md │ │ ├── 1674.Minimum-Moves-to-Make-Array-Complementary.md │ │ ├── 1675.Minimize-Deviation-in-Array.md │ │ ├── 1678.Goal-Parser-Interpretation.md │ │ ├── 1679.Max-Number-of-K-Sum-Pairs.md │ │ ├── 1680.Concatenation-of-Consecutive-Binary-Numbers.md │ │ ├── 1681.Minimum-Incompatibility.md │ │ ├── 1684.Count-the-Number-of-Consistent-Strings.md │ │ ├── 1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md │ │ ├── 1688.Count-of-Matches-in-Tournament.md │ │ ├── 1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers.md │ │ ├── 1690.Stone-Game-VII.md │ │ ├── 1691.Maximum-Height-by-Stacking-Cuboids.md │ │ ├── 1694.Reformat-Phone-Number.md │ │ ├── 1695.Maximum-Erasure-Value.md │ │ ├── 1696.Jump-Game-VI.md │ │ └── _index.md │ ├── 1700~1799 │ │ ├── 1700.Number-of-Students-Unable-to-Eat-Lunch.md │ │ ├── 1704.Determine-if-String-Halves-Are-Alike.md │ │ ├── 1705.Maximum-Number-of-Eaten-Apples.md │ │ ├── 1710.Maximum-Units-on-a-Truck.md │ │ ├── 1716.Calculate-Money-in-Leetcode-Bank.md │ │ ├── 1720.Decode-XORed-Array.md │ │ ├── 1721.Swapping-Nodes-in-a-Linked-List.md │ │ ├── 1725.Number-Of-Rectangles-That-Can-Form-The-Largest-Square.md │ │ ├── 1732.Find-the-Highest-Altitude.md │ │ ├── 1734.Decode-XORed-Permutation.md │ │ ├── 1736.Latest-Time-by-Replacing-Hidden-Digits.md │ │ ├── 1738.Find-Kth-Largest-XOR-Coordinate-Value.md │ │ ├── 1742.Maximum-Number-of-Balls-in-a-Box.md │ │ ├── 1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day.md │ │ ├── 1748.Sum-of-Unique-Elements.md │ │ ├── 1752.Check-if-Array-Is-Sorted-and-Rotated.md │ │ ├── 1758.Minimum-Changes-To-Make-Alternating-Binary-String.md │ │ ├── 1763.Longest-Nice-Substring.md │ │ ├── 1791.Find-Center-of-Star-Graph.md │ │ └── _index.md │ ├── 1800~1899 │ │ ├── 1816.Truncate-Sentence.md │ │ ├── 1818.Minimum-Absolute-Sum-Difference.md │ │ ├── 1846.Maximum-Element-After-Decreasing-and-Rearranging.md │ │ ├── 1877.Minimize-Maximum-Pair-Sum-in-Array.md │ │ └── _index.md │ ├── 1900~1999 │ │ ├── 1984.Minimum-Difference-Between-Highest-and-Lowest-of-K-Scores.md │ │ └── _index.md │ ├── 2000~2099 │ │ ├── 2021.Brightest-Position-on-Street.md │ │ ├── 2022.Convert-1D-Array-Into-2D-Array.md │ │ ├── 2037.Minimum-Number-of-Moves-to-Seat-Everyone.md │ │ ├── 2038.Remove-Colored-Pieces-if-Both-Neighbors-are-the-Same-Color.md │ │ ├── 2043.Simple-Bank-System.md │ │ ├── 2096.Step-By-Step-Directions-From-a-Binary-Tree-Node-to-Another.md │ │ └── _index.md │ ├── 2100~2199 │ │ ├── 2164.Sort-Even-and-Odd-Indices-Independently.md │ │ ├── 2165.Smallest-Value-of-the-Rearranged-Number.md │ │ ├── 2166.Design-Bitset.md │ │ ├── 2167.Minimum-Time-to-Remove-All-Cars-Containing-Illegal-Goods.md │ │ ├── 2169.Count-Operations-to-Obtain-Zero.md │ │ ├── 2170.Minimum-Operations-to-Make-the-Array-Alternating.md │ │ ├── 2171.Removing-Minimum-Number-of-Magic-Beans.md │ │ ├── 2180.Count-Integers-With-Even-Digit-Sum.md │ │ ├── 2181.Merge-Nodes-in-Between-Zeros.md │ │ ├── 2182.Construct-String-With-Repeat-Limit.md │ │ ├── 2183.Count-Array-Pairs-Divisible-by-K.md │ │ └── _index.md │ ├── 2200~2299 │ │ └── _index.md │ ├── _index.md │ └── pytool │ │ ├── AddTOC.py │ │ ├── CutContent.py │ │ ├── GenerateIndex.py │ │ ├── GenerateOne.py │ │ ├── GetFile.py │ │ └── WordCount.py ├── ChapterOne │ ├── Algorithm.md │ ├── Data_Structure.md │ ├── Time_Complexity.md │ └── _index.md ├── ChapterThree │ ├── Binary_Indexed_Tree.md │ ├── LFUCache.md │ ├── LRUCache.md │ ├── Segment_Tree.md │ ├── UnionFind.md │ └── _index.md ├── ChapterTwo │ ├── Array.md │ ├── Backtracking.md │ ├── Binary_Indexed_Tree.md │ ├── Binary_Search.md │ ├── Bit_Manipulation.md │ ├── Breadth_First_Search.md │ ├── Depth_First_Search.md │ ├── Dynamic_Programming.md │ ├── Hash_Table.md │ ├── Linked_List.md │ ├── Math.md │ ├── Segment_Tree.md │ ├── Sliding_Window.md │ ├── Sorting.md │ ├── Stack.md │ ├── String.md │ ├── Tree.md │ ├── Two_Pointers.md │ ├── Union_Find.md │ └── _index.md └── _index.md ├── resources └── _gen │ └── assets │ └── scss │ ├── book.scss_50fc8c04e12a2f59027287995557ceff.content │ ├── book.scss_50fc8c04e12a2f59027287995557ceff.json │ └── leetcode │ ├── book.scss_50fc8c04e12a2f59027287995557ceff.content │ └── book.scss_50fc8c04e12a2f59027287995557ceff.json ├── static ├── logo.png ├── prism.css ├── prism.js └── wechat-qr-code.png └── themes └── book ├── .github └── workflows │ └── main.yml ├── .gitignore ├── LICENSE ├── README.md ├── archetypes ├── docs.md └── posts.md ├── assets ├── _custom.scss ├── _defaults.scss ├── _fonts.scss ├── _main.scss ├── _markdown.scss ├── _print.scss ├── _shortcodes.scss ├── _utils.scss ├── _variables.scss ├── book.scss ├── manifest.json ├── menu-reset.js ├── mermaid.json ├── normalize.css ├── plugins │ ├── _dark.scss │ ├── _numbered.scss │ └── _scrollbars.scss ├── search-data.js ├── search.js ├── serviceworker-v1.js ├── sw-register.js ├── sw.js └── themes │ ├── _auto.scss │ ├── _dark.scss │ └── _light.scss ├── exampleSite ├── assets │ ├── _custom.scss │ └── _variables.scss ├── config.toml ├── config.yaml ├── content.bn │ └── _index.md ├── content.ru │ └── _index.md ├── content.zh │ └── _index.md ├── content │ ├── _index.md │ ├── docs │ │ ├── example │ │ │ ├── _index.md │ │ │ ├── collapsed │ │ │ │ ├── 3rd-level │ │ │ │ │ ├── 4th-level.md │ │ │ │ │ └── _index.md │ │ │ │ └── _index.md │ │ │ ├── hidden.md │ │ │ └── table-of-contents │ │ │ │ ├── _index.md │ │ │ │ ├── with-toc.md │ │ │ │ └── without-toc.md │ │ └── shortcodes │ │ │ ├── _index.md │ │ │ ├── buttons.md │ │ │ ├── columns.md │ │ │ ├── details.md │ │ │ ├── expand.md │ │ │ ├── hints.md │ │ │ ├── katex.md │ │ │ ├── mermaid.md │ │ │ ├── section │ │ │ ├── _index.md │ │ │ ├── page1.md │ │ │ └── page2.md │ │ │ └── tabs.md │ ├── menu │ │ └── index.md │ └── posts │ │ ├── _index.md │ │ ├── creating-a-new-theme.md │ │ ├── goisforlovers.md │ │ ├── hugoisforlovers.md │ │ └── migrate-from-jekyll.md └── resources │ └── _gen │ └── assets │ └── scss │ ├── book.scss_50fc8c04e12a2f59027287995557ceff.content │ └── book.scss_50fc8c04e12a2f59027287995557ceff.json ├── i18n ├── bn.yaml ├── cn.yaml ├── cs.yaml ├── de.yaml ├── en.yaml ├── es.yaml ├── fr.yaml ├── ja.yaml ├── jp.yaml ├── ko.yaml ├── nb.yaml ├── pt.yaml ├── ru.yaml ├── sv.yaml ├── tr.yaml ├── uk.yaml ├── zh-TW.yaml └── zh.yaml ├── images ├── screenshot.png └── tn.png ├── layouts ├── 404.html ├── _default │ ├── _markup │ │ ├── render-heading.html │ │ ├── render-image.html │ │ └── render-link.html │ ├── baseof.html │ ├── list.html │ └── single.html ├── partials │ └── docs │ │ ├── brand.html │ │ ├── comments.html │ │ ├── date.html │ │ ├── footer.html │ │ ├── gitalk.html │ │ ├── header.html │ │ ├── html-head.html │ │ ├── inject │ │ ├── body.html │ │ ├── content-after.html │ │ ├── content-before.html │ │ ├── footer.html │ │ ├── head.html │ │ ├── menu-after.html │ │ ├── menu-before.html │ │ ├── toc-after.html │ │ └── toc-before.html │ │ ├── languages.html │ │ ├── menu-bundle.html │ │ ├── menu-filetree.html │ │ ├── menu-hugo.html │ │ ├── menu.html │ │ ├── post-meta.html │ │ ├── search.html │ │ ├── taxonomy.html │ │ ├── title.html │ │ └── toc.html ├── posts │ ├── list.html │ └── single.html ├── shortcodes │ ├── button.html │ ├── columns.html │ ├── details.html │ ├── expand.html │ ├── hint.html │ ├── katex.html │ ├── mermaid.html │ ├── section.html │ ├── tab.html │ └── tabs.html └── taxonomy │ ├── list.html │ └── taxonomy.html ├── static ├── LeetCode_Icon.png ├── LeetCode_logo.png ├── LeetCode_logo2048.png ├── apple-touch-icon-1024x1024.png ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-512x512.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── favicon.png ├── favicon.svg ├── flexsearch.min.js ├── fonts │ ├── roboto-mono-v6-latin-regular.woff │ ├── roboto-mono-v6-latin-regular.woff2 │ ├── roboto-v19-latin-300italic.woff │ ├── roboto-v19-latin-300italic.woff2 │ ├── roboto-v19-latin-700.woff │ ├── roboto-v19-latin-700.woff2 │ ├── roboto-v19-latin-regular.woff │ └── roboto-v19-latin-regular.woff2 ├── js │ └── sw-toolbox.js ├── katex │ ├── auto-render.min.js │ ├── fonts │ │ ├── KaTeX_AMS-Regular.ttf │ │ ├── KaTeX_AMS-Regular.woff │ │ ├── KaTeX_AMS-Regular.woff2 │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ ├── KaTeX_Fraktur-Bold.woff │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ ├── KaTeX_Fraktur-Regular.woff │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ ├── KaTeX_Main-Bold.ttf │ │ ├── KaTeX_Main-Bold.woff │ │ ├── KaTeX_Main-Bold.woff2 │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ ├── KaTeX_Main-BoldItalic.woff │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ ├── KaTeX_Main-Italic.ttf │ │ ├── KaTeX_Main-Italic.woff │ │ ├── KaTeX_Main-Italic.woff2 │ │ ├── KaTeX_Main-Regular.ttf │ │ ├── KaTeX_Main-Regular.woff │ │ ├── KaTeX_Main-Regular.woff2 │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ ├── KaTeX_Math-BoldItalic.woff │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ ├── KaTeX_Math-Italic.ttf │ │ ├── KaTeX_Math-Italic.woff │ │ ├── KaTeX_Math-Italic.woff2 │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ ├── KaTeX_SansSerif-Bold.woff │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ ├── KaTeX_SansSerif-Italic.woff │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ ├── KaTeX_SansSerif-Regular.woff │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ ├── KaTeX_Script-Regular.ttf │ │ ├── KaTeX_Script-Regular.woff │ │ ├── KaTeX_Script-Regular.woff2 │ │ ├── KaTeX_Size1-Regular.ttf │ │ ├── KaTeX_Size1-Regular.woff │ │ ├── KaTeX_Size1-Regular.woff2 │ │ ├── KaTeX_Size2-Regular.ttf │ │ ├── KaTeX_Size2-Regular.woff │ │ ├── KaTeX_Size2-Regular.woff2 │ │ ├── KaTeX_Size3-Regular.ttf │ │ ├── KaTeX_Size3-Regular.woff │ │ ├── KaTeX_Size3-Regular.woff2 │ │ ├── KaTeX_Size4-Regular.ttf │ │ ├── KaTeX_Size4-Regular.woff │ │ ├── KaTeX_Size4-Regular.woff2 │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ ├── KaTeX_Typewriter-Regular.woff │ │ └── KaTeX_Typewriter-Regular.woff2 │ ├── katex.min.css │ └── katex.min.js ├── mermaid.min.js ├── prism.css ├── prism.js └── svg │ ├── calendar.svg │ ├── edit.svg │ ├── menu.svg │ ├── toc.svg │ └── translate.svg └── theme.toml /.gitignore: -------------------------------------------------------------------------------- 1 | *.toml 2 | .idea 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - master 5 | 6 | # whitelist 7 | branches: 8 | only: 9 | - master 10 | 11 | script: 12 | - go get -t -v ./... 13 | - go vet ./... 14 | - bash ./gotest.sh 15 | 16 | after_success: 17 | - bash <(curl -s https://codecov.io/bash) 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch", 9 | "type": "go", 10 | "request": "launch", 11 | "mode": "auto", 12 | "program": "${fileDirname}", 13 | "env": {}, 14 | "args": [] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "go.formatTool": "gofmt", 3 | "go.formatFlags": [ 4 | "-s" 5 | ], 6 | "go.autocompleteUnimportedPackages": true, 7 | "[go]": { 8 | "editor.insertSpaces": false, 9 | "editor.formatOnSave": true, 10 | "editor.codeActionsOnSave": { 11 | "source.organizeImports": true 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /ctl/command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | var rootCmd = &cobra.Command{ 11 | Use: "leetcode-go", 12 | Short: "A simple command line client for leetcode-go.", 13 | } 14 | 15 | func execute() { 16 | if err := rootCmd.Execute(); err != nil { 17 | fmt.Println(err) 18 | os.Exit(-1) 19 | } 20 | } 21 | 22 | func init() { 23 | rootCmd.AddCommand( 24 | versionCmd, 25 | newBuildCommand(), 26 | newLabelCommand(), 27 | newPDFCommand(), 28 | newRefresh(), 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /ctl/error.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | const ( 9 | // ExitSuccess define 10 | ExitSuccess = iota 11 | // ExitError define 12 | ExitError 13 | // ExitBadArgs define 14 | ExitBadArgs 15 | ) 16 | 17 | // ExitWithError define 18 | func ExitWithError(code int, err error) { 19 | fmt.Fprintln(os.Stderr, "Error: ", err) 20 | os.Exit(code) 21 | } 22 | -------------------------------------------------------------------------------- /ctl/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | execute() 5 | } 6 | -------------------------------------------------------------------------------- /ctl/meta/Binary_Indexed_Tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/ctl/meta/Binary_Indexed_Tree -------------------------------------------------------------------------------- /ctl/meta/PDFPreface: -------------------------------------------------------------------------------- 1 | logo 2 | 3 | 4 | # 说明 5 | 6 | 此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V1.5.20。PDF 永久更新地址是 https://github.com/halfrost/leetcode-go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star,鼓励一下笔者早点更新更多题解。 7 | 8 | > 版本号说明,V1.5.20,1 是大版本号,5 代表当前题解中有几百题,目前是 520 题,所以第二个版本号是 5,20 代表当前题解中有几十题,目前是 520 题,所以第三个版本号是 20 。 9 | 10 | # 目录 11 | 12 | [toc] -------------------------------------------------------------------------------- /ctl/meta/meta: -------------------------------------------------------------------------------- 1 | | Title | Solution | Difficulty | Time | Space |收藏| 2 | | ----- | :--------: | :----------: | :----: | :-----: | :-----: | -------------------------------------------------------------------------------- /ctl/models/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/halfrost/LeetCode-Go/ctl/models 2 | 3 | go 1.19 4 | 5 | replace github.com/halfrost/LeetCode-Go/ctl/models => ../util 6 | 7 | require github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0 8 | -------------------------------------------------------------------------------- /ctl/models/go.sum: -------------------------------------------------------------------------------- 1 | github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0 h1:WAOAj59szR52uAnEQljAt7ucpbGGOsy0xgR/NeP4Xbc= 2 | github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0/go.mod h1:+cA8KYcbGxP2Itd3NG+QJVGL/MEZISKlei0tvgDeEag= 3 | -------------------------------------------------------------------------------- /ctl/template/Array.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.01 Array 3 | type: docs 4 | weight: 1 5 | --- 6 | 7 | # Array 8 | 9 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Binary_Indexed_Tree.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.19 ✅ Binary Indexed Tree 3 | type: docs 4 | weight: 19 5 | --- 6 | 7 | # Binary Indexed Tree 8 | 9 | ![](https://img.halfrost.com/Leetcode/Binary_Indexed_Tree.png) 10 | 11 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Breadth_First_Search.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.10 Breadth First Search 3 | type: docs 4 | weight: 10 5 | --- 6 | 7 | # Breadth First Search 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Depth_First_Search.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.09 Depth First Search 3 | type: docs 4 | weight: 9 5 | --- 6 | 7 | # Depth First Search 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Dynamic_Programming.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.07 Dynamic Programming 3 | type: docs 4 | weight: 7 5 | --- 6 | 7 | # Dynamic Programming 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Hash_Table.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.13 Hash Table 3 | type: docs 4 | weight: 13 5 | --- 6 | 7 | # Hash Table 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Math.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.12 Math 3 | type: docs 4 | weight: 12 5 | --- 6 | 7 | # Math 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Sorting.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.14 ✅ Sorting 3 | type: docs 4 | weight: 14 5 | --- 6 | 7 | # Sorting 8 | 9 | ![](https://img.halfrost.com/Leetcode/Sort.png) 10 | 11 | - 深刻的理解多路快排。第 75 题。 12 | - 链表的排序,插入排序(第 147 题)和归并排序(第 148 题) 13 | - 桶排序和基数排序。第 164 题。 14 | - "摆动排序"。第 324 题。 15 | - 两两不相邻的排序。第 767 题,第 1054 题。 16 | - "饼子排序"。第 969 题。 17 | 18 | 19 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Stack.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.05 ✅ Stack 3 | type: docs 4 | weight: 5 5 | --- 6 | 7 | # Stack 8 | 9 | ![](https://img.halfrost.com/Leetcode/Stack.png) 10 | 11 | - 括号匹配问题及类似问题。第 20 题,第 921 题,第 1021 题。 12 | - 栈的基本 pop 和 push 操作。第 71 题,第 150 题,第 155 题,第 224 题,第 225 题,第 232 题,第 946 题,第 1047 题。 13 | - 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。 14 | - **单调栈**。**利用栈维护一个单调递增或者递减的下标数组**。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。 15 | 16 | 17 | 18 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/String.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.02 String 3 | type: docs 4 | weight: 2 5 | --- 6 | 7 | # String 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/Tree.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 2.06 Tree 3 | type: docs 4 | weight: 6 5 | --- 6 | 7 | # Tree 8 | 9 | 10 | {{.AvailableTagTable}} -------------------------------------------------------------------------------- /ctl/template/collapseSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /ctl/template/menu.md: -------------------------------------------------------------------------------- 1 | --- 2 | headless: true 3 | --- 4 | 5 |
6 | 7 | {{.BookMenu}} 8 | 9 |
10 | -------------------------------------------------------------------------------- /ctl/util/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/halfrost/LeetCode-Go/ctl/util 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /ctl/version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | ) 8 | 9 | var ( 10 | version = "v1.0" 11 | versionCmd = &cobra.Command{ 12 | Use: "version", 13 | Short: "Prints the version of tacoctl", 14 | Run: func(cmd *cobra.Command, args []string) { 15 | fmt.Println("tacoctl version:", version) 16 | }, 17 | } 18 | ) 19 | -------------------------------------------------------------------------------- /gotest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./leetcode/... | grep -v vendor); do 7 | echo $d 8 | go test -coverprofile=profile.out -covermode=atomic $d 9 | if [ -f profile.out ]; then 10 | cat profile.out >> coverage.txt 11 | rm profile.out 12 | fi 13 | done 14 | -------------------------------------------------------------------------------- /leetcode/0001.Two-Sum/1. Two Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func twoSum(nums []int, target int) []int { 4 | m := make(map[int]int) 5 | for k, v := range nums { 6 | if idx, ok := m[target-v]; ok { 7 | return []int{idx, k} 8 | } 9 | m[v] = k 10 | } 11 | return nil 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0007.Reverse-Integer/7. Reverse Integer.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func reverse7(x int) int { 4 | tmp := 0 5 | for x != 0 { 6 | tmp = tmp*10 + x%10 7 | x = x / 10 8 | } 9 | if tmp > 1<<31-1 || tmp < -(1<<31) { 10 | return 0 11 | } 12 | return tmp 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0011.Container-With-Most-Water/11. Container With Most Water.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxArea(height []int) int { 4 | max, start, end := 0, 0, len(height)-1 5 | for start < end { 6 | width := end - start 7 | high := 0 8 | if height[start] < height[end] { 9 | high = height[start] 10 | start++ 11 | } else { 12 | high = height[end] 13 | end-- 14 | } 15 | 16 | temp := width * high 17 | if temp > max { 18 | max = temp 19 | } 20 | } 21 | return max 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0012.Integer-to-Roman/12. Integer to Roman.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func intToRoman(num int) string { 4 | values := []int{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1} 5 | symbols := []string{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"} 6 | res, i := "", 0 7 | for num != 0 { 8 | for values[i] > num { 9 | i++ 10 | } 11 | num -= values[i] 12 | res += symbols[i] 13 | } 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0014.Longest-Common-Prefix/14.Longest Common Prefix.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func longestCommonPrefix(strs []string) string { 4 | prefix := strs[0] 5 | 6 | for i := 1; i < len(strs); i++ { 7 | for j := 0; j < len(prefix); j++ { 8 | if len(strs[i]) <= j || strs[i][j] != prefix[j] { 9 | prefix = prefix[0:j] 10 | break 11 | } 12 | } 13 | } 14 | 15 | return prefix 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0021.Merge-Two-Sorted-Lists/README.md: -------------------------------------------------------------------------------- 1 | # [21. Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/) 2 | 3 | ## 题目 4 | 5 | Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 6 | 7 | Example : 8 | 9 | ``` 10 | Input: 1->2->4, 1->3->4 11 | Output: 1->1->2->3->4->4 12 | 13 | ``` 14 | 15 | ## 题目大意 16 | 17 | 合并 2 个有序链表 18 | 19 | ## 解题思路 20 | 21 | 按照题意做即可。 -------------------------------------------------------------------------------- /leetcode/0023.Merge-k-Sorted-Lists/README.md: -------------------------------------------------------------------------------- 1 | # [23. Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) 2 | 3 | ## 题目 4 | 5 | Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 6 | 7 | 8 | 9 | Example : 10 | 11 | ``` 12 | Input: 13 | [ 14 | 1->4->5, 15 | 1->3->4, 16 | 2->6 17 | ] 18 | Output: 1->1->2->3->4->4->5->6 19 | 20 | ``` 21 | 22 | ## 题目大意 23 | 24 | 合并 K 个有序链表 25 | 26 | ## 解题思路 27 | 28 | 借助分治的思想,把 K 个有序链表两两合并即可。相当于是第 21 题的加强版。 -------------------------------------------------------------------------------- /leetcode/0024.Swap-Nodes-in-Pairs/README.md: -------------------------------------------------------------------------------- 1 | # [24. Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/description/) 2 | 3 | ## 题目 4 | 5 | Given a linked list, swap every two adjacent nodes and return its head. 6 | 7 | You may not modify the values in the list's nodes, only nodes itself may be changed. 8 | 9 | 10 | 11 | Example: 12 | 13 | ```c 14 | Given 1->2->3->4, you should return the list as 2->1->4->3. 15 | ``` 16 | 17 | ## 题目大意 18 | 19 | 两两相邻的元素,翻转链表 20 | 21 | ## 解题思路 22 | 23 | 按照题意做即可。 -------------------------------------------------------------------------------- /leetcode/0027.Remove-Element/27. Remove Element.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removeElement(nums []int, val int) int { 4 | if len(nums) == 0 { 5 | return 0 6 | } 7 | j := 0 8 | for i := 0; i < len(nums); i++ { 9 | if nums[i] != val { 10 | if i != j { 11 | nums[i], nums[j] = nums[j], nums[i] 12 | } 13 | j++ 14 | } 15 | } 16 | return j 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0035.Search-Insert-Position/35. Search Insert Position.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func searchInsert(nums []int, target int) int { 4 | low, high := 0, len(nums)-1 5 | for low <= high { 6 | mid := low + (high-low)>>1 7 | if nums[mid] >= target { 8 | high = mid - 1 9 | } else { 10 | if (mid == len(nums)-1) || (nums[mid+1] >= target) { 11 | return mid + 1 12 | } 13 | low = mid + 1 14 | } 15 | } 16 | return 0 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0041.First-Missing-Positive/41. First Missing Positive.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func firstMissingPositive(nums []int) int { 4 | numMap := make(map[int]int, len(nums)) 5 | for _, v := range nums { 6 | numMap[v] = v 7 | } 8 | for index := 1; index < len(nums)+1; index++ { 9 | if _, ok := numMap[index]; !ok { 10 | return index 11 | } 12 | } 13 | return len(nums) + 1 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0045.Jump-Game-II/45. Jump Game II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func jump(nums []int) int { 4 | if len(nums) == 1 { 5 | return 0 6 | } 7 | needChoose, canReach, step := 0, 0, 0 8 | for i, x := range nums { 9 | if i+x > canReach { 10 | canReach = i + x 11 | if canReach >= len(nums)-1 { 12 | return step + 1 13 | } 14 | } 15 | if i == needChoose { 16 | needChoose = canReach 17 | step++ 18 | } 19 | } 20 | return step 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0046.Permutations/README.md: -------------------------------------------------------------------------------- 1 | # [46. Permutations](https://leetcode.com/problems/permutations/) 2 | 3 | 4 | ## 题目 5 | 6 | Given a collection of **distinct** integers, return all possible permutations. 7 | 8 | **Example:** 9 | 10 | 11 | Input: [1,2,3] 12 | Output: 13 | [ 14 | [1,2,3], 15 | [1,3,2], 16 | [2,1,3], 17 | [2,3,1], 18 | [3,1,2], 19 | [3,2,1] 20 | ] 21 | 22 | 23 | ## 题目大意 24 | 25 | 给定一个没有重复数字的序列,返回其所有可能的全排列。 26 | 27 | 28 | ## 解题思路 29 | 30 | - 求出一个数组的排列组合中的所有排列,用 DFS 深搜即可。 31 | -------------------------------------------------------------------------------- /leetcode/0050.Powx-n/50. Pow(x, n).go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 时间复杂度 O(log n),空间复杂度 O(1) 4 | func myPow(x float64, n int) float64 { 5 | if n == 0 { 6 | return 1 7 | } 8 | if n == 1 { 9 | return x 10 | } 11 | if n < 0 { 12 | n = -n 13 | x = 1 / x 14 | } 15 | tmp := myPow(x, n/2) 16 | if n%2 == 0 { 17 | return tmp * tmp 18 | } 19 | return tmp * tmp * x 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0055.Jump-Game/55. Jump Game.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canJump(nums []int) bool { 4 | n := len(nums) 5 | if n == 0 { 6 | return false 7 | } 8 | if n == 1 { 9 | return true 10 | } 11 | maxJump := 0 12 | for i, v := range nums { 13 | if i > maxJump { 14 | return false 15 | } 16 | maxJump = max(maxJump, i+v) 17 | } 18 | return true 19 | } 20 | 21 | func max(a int, b int) int { 22 | if a > b { 23 | return a 24 | } 25 | return b 26 | } 27 | -------------------------------------------------------------------------------- /leetcode/0058.Length-of-Last-Word/58.Length of Last Word.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func lengthOfLastWord(s string) int { 4 | last := len(s) - 1 5 | for last >= 0 && s[last] == ' ' { 6 | last-- 7 | } 8 | if last < 0 { 9 | return 0 10 | } 11 | first := last 12 | for first >= 0 && s[first] != ' ' { 13 | first-- 14 | } 15 | return last - first 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0062.Unique-Paths/62. Unique Paths.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func uniquePaths(m int, n int) int { 4 | dp := make([][]int, n) 5 | for i := 0; i < n; i++ { 6 | dp[i] = make([]int, m) 7 | } 8 | for i := 0; i < n; i++ { 9 | for j := 0; j < m; j++ { 10 | if i == 0 || j == 0 { 11 | dp[i][j] = 1 12 | continue 13 | } 14 | dp[i][j] = dp[i-1][j] + dp[i][j-1] 15 | } 16 | } 17 | return dp[n-1][m-1] 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0066.Plus-One/66. Plus One.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func plusOne(digits []int) []int { 4 | for i := len(digits) - 1; i >= 0; i-- { 5 | if digits[i] != 9 { 6 | digits[i]++ 7 | return digits 8 | } 9 | digits[i] = 0 10 | } 11 | return append([]int{1}, digits...) 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0070.Climbing-Stairs/70. Climbing Stairs.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func climbStairs(n int) int { 4 | dp := make([]int, n+1) 5 | dp[0], dp[1] = 1, 1 6 | for i := 2; i <= n; i++ { 7 | dp[i] = dp[i-1] + dp[i-2] 8 | } 9 | return dp[n] 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0074.Search-a-2D-Matrix/74. Search a 2D Matrix.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func searchMatrix(matrix [][]int, target int) bool { 4 | if len(matrix) == 0 { 5 | return false 6 | } 7 | m, low, high := len(matrix[0]), 0, len(matrix[0])*len(matrix)-1 8 | for low <= high { 9 | mid := low + (high-low)>>1 10 | if matrix[mid/m][mid%m] == target { 11 | return true 12 | } else if matrix[mid/m][mid%m] > target { 13 | high = mid - 1 14 | } else { 15 | low = mid + 1 16 | } 17 | } 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0075.Sort-Colors/75. Sort Colors.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func sortColors(nums []int) { 4 | zero, one := 0, 0 5 | for i, n := range nums { 6 | nums[i] = 2 7 | if n <= 1 { 8 | nums[one] = 1 9 | one++ 10 | } 11 | if n == 0 { 12 | nums[zero] = 0 13 | zero++ 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0077.Combinations/README.md: -------------------------------------------------------------------------------- 1 | # [77. Combinations](https://leetcode.com/problems/combinations/) 2 | 3 | 4 | ## 题目 5 | 6 | Given two integers *n* and *k*, return all possible combinations of *k* numbers out of 1 ... *n*. 7 | 8 | **Example:** 9 | 10 | Input: n = 4, k = 2 11 | Output: 12 | [ 13 | [2,4], 14 | [3,4], 15 | [2,3], 16 | [1,2], 17 | [1,3], 18 | [1,4], 19 | ] 20 | 21 | ## 题目大意 22 | 23 | 给定两个整数 n 和 k,返回 1 ... n 中所有可能的 k 个数的组合。 24 | 25 | ## 解题思路 26 | 27 | - 计算排列组合中的组合,用 DFS 深搜即可,注意剪枝 28 | -------------------------------------------------------------------------------- /leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removeDuplicates(nums []int) int { 4 | slow := 0 5 | for fast, v := range nums { 6 | if fast < 2 || nums[slow-2] != v { 7 | nums[slow] = v 8 | slow++ 9 | } 10 | } 11 | return slow 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0083.Remove-Duplicates-from-Sorted-List/README.md: -------------------------------------------------------------------------------- 1 | # [83. Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list/) 2 | 3 | ## 题目 4 | 5 | Given a sorted linked list, delete all duplicates such that each element appear only once. 6 | 7 | Example 1: 8 | 9 | ``` 10 | Input: 1->1->2 11 | Output: 1->2 12 | ``` 13 | 14 | Example 2: 15 | 16 | ``` 17 | Input: 1->1->2->3->3 18 | Output: 1->2->3 19 | ``` 20 | 21 | ## 题目大意 22 | 23 | 删除链表中重复的结点,以保障每个结点只出现一次。 24 | 25 | 26 | ## 解题思路 27 | 28 | 按照题意做即可。 -------------------------------------------------------------------------------- /leetcode/0088.Merge-Sorted-Array/88. Merge Sorted Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func merge(nums1 []int, m int, nums2 []int, n int) { 4 | for p := m + n; m > 0 && n > 0; p-- { 5 | if nums1[m-1] <= nums2[n-1] { 6 | nums1[p-1] = nums2[n-1] 7 | n-- 8 | } else { 9 | nums1[p-1] = nums1[m-1] 10 | m-- 11 | } 12 | } 13 | for ; n > 0; n-- { 14 | nums1[n-1] = nums2[n-1] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0091.Decode-Ways/91. Decode Ways.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numDecodings(s string) int { 4 | n := len(s) 5 | dp := make([]int, n+1) 6 | dp[0] = 1 7 | for i := 1; i <= n; i++ { 8 | if s[i-1] != '0' { 9 | dp[i] += dp[i-1] 10 | } 11 | if i > 1 && s[i-2] != '0' && (s[i-2]-'0')*10+(s[i-1]-'0') <= 26 { 12 | dp[i] += dp[i-2] 13 | } 14 | } 15 | return dp[n] 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0093.Restore-IP-Addresses/README.md: -------------------------------------------------------------------------------- 1 | # [93. Restore IP Addresses](https://leetcode.com/problems/restore-ip-addresses/) 2 | 3 | 4 | ## 题目 5 | 6 | Given a string containing only digits, restore it by returning all possible valid IP address combinations. 7 | 8 | **Example:** 9 | 10 | Input: "25525511135" 11 | Output: ["255.255.11.135", "255.255.111.35"] 12 | 13 | ## 题目大意 14 | 15 | 给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。 16 | 17 | ## 解题思路 18 | 19 | - DFS 深搜 20 | - 需要注意的点是 IP 的规则,以 0 开头的数字和超过 255 的数字都为非法的。 21 | 22 | -------------------------------------------------------------------------------- /leetcode/0096.Unique-Binary-Search-Trees/96. Unique Binary Search Trees.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numTrees(n int) int { 4 | dp := make([]int, n+1) 5 | dp[0], dp[1] = 1, 1 6 | for i := 2; i <= n; i++ { 7 | for j := 1; j <= i; j++ { 8 | dp[i] += dp[j-1] * dp[i-j] 9 | } 10 | } 11 | return dp[n] 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0118.Pascals-Triangle/118. Pascals Triangle.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func generate(numRows int) [][]int { 4 | result := [][]int{} 5 | for i := 0; i < numRows; i++ { 6 | row := []int{} 7 | for j := 0; j < i+1; j++ { 8 | if j == 0 || j == i { 9 | row = append(row, 1) 10 | } else if i > 1 { 11 | row = append(row, result[i-1][j-1]+result[i-1][j]) 12 | } 13 | } 14 | result = append(result, row) 15 | } 16 | return result 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0119.Pascals-Triangle-II/119. Pascals Triangle II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func getRow(rowIndex int) []int { 4 | row := make([]int, rowIndex+1) 5 | row[0] = 1 6 | for i := 1; i <= rowIndex; i++ { 7 | row[i] = row[i-1] * (rowIndex - i + 1) / i 8 | } 9 | return row 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II/122. Best Time to Buy and Sell Stock II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxProfit122(prices []int) int { 4 | profit := 0 5 | for i := 0; i < len(prices)-1; i++ { 6 | if prices[i+1] > prices[i] { 7 | profit += prices[i+1] - prices[i] 8 | } 9 | } 10 | return profit 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/0134.Gas-Station/Gas.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canCompleteCircuit(gas []int, cost []int) int { 4 | totalGas := 0 5 | totalCost := 0 6 | currGas := 0 7 | start := 0 8 | 9 | for i := 0; i < len(gas); i++ { 10 | totalGas += gas[i] 11 | totalCost += cost[i] 12 | currGas += gas[i] - cost[i] 13 | 14 | if currGas < 0 { 15 | start = i + 1 16 | currGas = 0 17 | } 18 | } 19 | 20 | if totalGas < totalCost { 21 | return -1 22 | } 23 | 24 | return start 25 | 26 | } 27 | -------------------------------------------------------------------------------- /leetcode/0135.Candy/135. Candy.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func candy(ratings []int) int { 4 | candies := make([]int, len(ratings)) 5 | for i := 1; i < len(ratings); i++ { 6 | if ratings[i] > ratings[i-1] { 7 | candies[i] += candies[i-1] + 1 8 | } 9 | } 10 | for i := len(ratings) - 2; i >= 0; i-- { 11 | if ratings[i] > ratings[i+1] && candies[i] <= candies[i+1] { 12 | candies[i] = candies[i+1] + 1 13 | } 14 | } 15 | total := 0 16 | for _, candy := range candies { 17 | total += candy + 1 18 | } 19 | return total 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0136.Single-Number/136. Single Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func singleNumber(nums []int) int { 4 | result := 0 5 | for i := 0; i < len(nums); i++ { 6 | result ^= nums[i] 7 | } 8 | return result 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0141.Linked-List-Cycle/README.md: -------------------------------------------------------------------------------- 1 | # [141. Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/description/) 2 | 3 | ## 题目 4 | 5 | Given a linked list, determine if it has a cycle in it. 6 | 7 | Follow up: 8 | Can you solve it without using extra space? 9 | 10 | 11 | 12 | ## 题目大意 13 | 14 | 判断链表是否有环,不能使用额外的空间。 15 | 16 | ## 解题思路 17 | 18 | 给 2 个指针,一个指针是另外一个指针的下一个指针。快指针一次走 2 格,慢指针一次走 1 格。如果存在环,那么前一个指针一定会经过若干圈之后追上慢的指针。 -------------------------------------------------------------------------------- /leetcode/0142.Linked-List-Cycle-II/142. Linked List Cycle II_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "testing" 4 | 5 | func Test_Problem142(t *testing.T) { 6 | } 7 | -------------------------------------------------------------------------------- /leetcode/0148.Sort-List/README.md: -------------------------------------------------------------------------------- 1 | # [148. Sort List](https://leetcode.com/problems/sort-list/) 2 | 3 | ## 题目 4 | 5 | Sort a linked list in O(n log n) time using constant space complexity. 6 | 7 | Example 1: 8 | 9 | ```c 10 | Input: 4->2->1->3 11 | Output: 1->2->3->4 12 | ``` 13 | 14 | Example 2: 15 | 16 | ```c 17 | Input: -1->5->3->4->0 18 | Output: -1->0->3->4->5 19 | ``` 20 | 21 | ## 题目大意 22 | 23 | 链表的排序,要求时间复杂度必须是 O(n log n),空间复杂度是 O(1) 24 | 25 | ## 解题思路 26 | 27 | 这道题只能用归并排序才能符合要求。归并排序需要的 2 个操作在其他题目已经出现过了,取中间点是第 876 题,合并 2 个有序链表是第 21 题。 -------------------------------------------------------------------------------- /leetcode/0151.Reverse-Words-in-a-String/151. Reverse Words in a String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func reverseWords151(s string) string { 6 | ss := strings.Fields(s) 7 | reverse151(&ss, 0, len(ss)-1) 8 | return strings.Join(ss, " ") 9 | } 10 | 11 | func reverse151(m *[]string, i int, j int) { 12 | for i <= j { 13 | (*m)[i], (*m)[j] = (*m)[j], (*m)[i] 14 | i++ 15 | j-- 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II/154. Find Minimum in Rotated Sorted Array II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findMin154(nums []int) int { 4 | low, high := 0, len(nums)-1 5 | for low < high { 6 | if nums[low] < nums[high] { 7 | return nums[low] 8 | } 9 | mid := low + (high-low)>>1 10 | if nums[mid] > nums[low] { 11 | low = mid + 1 12 | } else if nums[mid] == nums[low] { 13 | low++ 14 | } else { 15 | high = mid 16 | } 17 | } 18 | return nums[low] 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0155.Min-Stack/155. Min Stack_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem155(t *testing.T) { 9 | obj1 := Constructor155() 10 | obj1.Push(1) 11 | fmt.Printf("obj1 = %v\n", obj1) 12 | obj1.Push(0) 13 | fmt.Printf("obj1 = %v\n", obj1) 14 | obj1.Push(10) 15 | fmt.Printf("obj1 = %v\n", obj1) 16 | obj1.Pop() 17 | fmt.Printf("obj1 = %v\n", obj1) 18 | param3 := obj1.Top() 19 | fmt.Printf("param_3 = %v\n", param3) 20 | param4 := obj1.GetMin() 21 | fmt.Printf("param_4 = %v\n", param4) 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0168.Excel-Sheet-Column-Title/168. Excel Sheet Column Title.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func convertToTitle(n int) string { 4 | result := []byte{} 5 | for n > 0 { 6 | result = append(result, 'A'+byte((n-1)%26)) 7 | n = (n - 1) / 26 8 | } 9 | for i, j := 0, len(result)-1; i < j; i, j = i+1, j-1 { 10 | result[i], result[j] = result[j], result[i] 11 | } 12 | return string(result) 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0171.Excel-Sheet-Column-Number/171. Excel Sheet Column Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func titleToNumber(s string) int { 4 | val, res := 0, 0 5 | for i := 0; i < len(s); i++ { 6 | val = int(s[i] - 'A' + 1) 7 | res = res*26 + val 8 | } 9 | return res 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0172.Factorial-Trailing-Zeroes/172. Factorial Trailing Zeroes.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func trailingZeroes(n int) int { 4 | if n/5 == 0 { 5 | return 0 6 | } 7 | return n/5 + trailingZeroes(n/5) 8 | } 9 | -------------------------------------------------------------------------------- /leetcode/0190.Reverse-Bits/190. Reverse Bits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func reverseBits(num uint32) uint32 { 4 | var res uint32 5 | for i := 0; i < 32; i++ { 6 | res = res<<1 | num&1 7 | num >>= 1 8 | } 9 | return res 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0191.Number-of-1-Bits/191. Number of 1 Bits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math/bits" 4 | 5 | // 解法一 6 | func hammingWeight(num uint32) int { 7 | return bits.OnesCount(uint(num)) 8 | } 9 | 10 | // 解法二 11 | func hammingWeight1(num uint32) int { 12 | count := 0 13 | for num != 0 { 14 | num = num & (num - 1) 15 | count++ 16 | } 17 | return count 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0201.Bitwise-AND-of-Numbers-Range/201. Bitwise AND of Numbers Range.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 解法一 4 | func rangeBitwiseAnd1(m int, n int) int { 5 | if m == 0 { 6 | return 0 7 | } 8 | moved := 0 9 | for m != n { 10 | m >>= 1 11 | n >>= 1 12 | moved++ 13 | } 14 | return m << uint32(moved) 15 | } 16 | 17 | // 解法二 Brian Kernighan's algorithm 18 | func rangeBitwiseAnd(m int, n int) int { 19 | for n > m { 20 | n &= (n - 1) // 清除最低位的 1 21 | } 22 | return n 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/0203.Remove-Linked-List-Elements/README.md: -------------------------------------------------------------------------------- 1 | # [203. Remove Linked List Elements](https://leetcode.com/problems/remove-linked-list-elements/) 2 | 3 | ## 题目 4 | 5 | Remove all elements from a linked list of integers that have value val. 6 | 7 | Example : 8 | 9 | ```c 10 | Input: 1->2->6->3->4->5->6, val = 6 11 | Output: 1->2->3->4->5 12 | ``` 13 | 14 | 15 | ## 题目大意 16 | 17 | 删除链表中所有指定值的结点。 18 | 19 | ## 解题思路 20 | 21 | 按照题意做即可。 -------------------------------------------------------------------------------- /leetcode/0204.Count-Primes/204. Count Primes.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countPrimes(n int) int { 4 | isNotPrime := make([]bool, n) 5 | for i := 2; i*i < n; i++ { 6 | if isNotPrime[i] { 7 | continue 8 | } 9 | for j := i * i; j < n; j = j + i { 10 | isNotPrime[j] = true 11 | } 12 | } 13 | count := 0 14 | for i := 2; i < n; i++ { 15 | if !isNotPrime[i] { 16 | count++ 17 | } 18 | } 19 | return count 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0204.Count-Primes/README.md: -------------------------------------------------------------------------------- 1 | # [204. Count Primes](https://leetcode.com/problems/count-primes/) 2 | 3 | 4 | ## 题目 5 | 6 | Count the number of prime numbers less than a non-negative number, **n**. 7 | 8 | **Example:** 9 | 10 | Input: 10 11 | Output: 4 12 | Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. 13 | 14 | 15 | ## 题目大意 16 | 17 | 统计所有小于非负整数 n 的质数的数量。 18 | 19 | 20 | ## 解题思路 21 | 22 | - 给出一个数字 n,要求输出小于 n 的所有素数的个数总和。简单题。 23 | -------------------------------------------------------------------------------- /leetcode/0206.Reverse-Linked-List/README.md: -------------------------------------------------------------------------------- 1 | # [206. Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/description/) 2 | 3 | ## 题目 4 | 5 | Reverse a singly linked list. 6 | 7 | ## 题目大意 8 | 9 | 翻转单链表 10 | 11 | 12 | ## 解题思路 13 | 14 | 按照题意做即可。 -------------------------------------------------------------------------------- /leetcode/0209.Minimum-Size-Subarray-Sum/209. Minimum Size Subarray Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minSubArrayLen(target int, nums []int) int { 4 | left, sum, res := 0, 0, len(nums)+1 5 | for right, v := range nums { 6 | sum += v 7 | for sum >= target { 8 | res = min(res, right-left+1) 9 | sum -= nums[left] 10 | left++ 11 | } 12 | } 13 | if res == len(nums)+1 { 14 | return 0 15 | } 16 | return res 17 | } 18 | 19 | func min(a int, b int) int { 20 | if a > b { 21 | return b 22 | } 23 | return a 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0217.Contains-Duplicate/217. Contains Duplicate.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func containsDuplicate(nums []int) bool { 4 | record := make(map[int]bool, len(nums)) 5 | for _, n := range nums { 6 | if _, found := record[n]; found { 7 | return true 8 | } 9 | record[n] = true 10 | } 11 | return false 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0219.Contains-Duplicate-II/219. Contains Duplicate II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func containsNearbyDuplicate(nums []int, k int) bool { 4 | if len(nums) <= 1 { 5 | return false 6 | } 7 | if k <= 0 { 8 | return false 9 | } 10 | record := make(map[int]bool, len(nums)) 11 | for i, n := range nums { 12 | if _, found := record[n]; found { 13 | return true 14 | } 15 | record[n] = true 16 | if len(record) == k+1 { 17 | delete(record, nums[i-k]) 18 | } 19 | } 20 | return false 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0228.Summary-Ranges/228. Summary Ranges.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "strconv" 5 | ) 6 | 7 | func summaryRanges(nums []int) (ans []string) { 8 | for i, n := 0, len(nums); i < n; { 9 | left := i 10 | for i++; i < n && nums[i-1]+1 == nums[i]; i++ { 11 | } 12 | s := strconv.Itoa(nums[left]) 13 | if left != i-1 { 14 | s += "->" + strconv.Itoa(nums[i-1]) 15 | } 16 | ans = append(ans, s) 17 | } 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0237.Delete-Node-in-a-Linked-List/237. Delete Node in a Linked List.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "github.com/halfrost/LeetCode-Go/structures" 5 | ) 6 | 7 | // ListNode define 8 | type ListNode = structures.ListNode 9 | 10 | /** 11 | * Definition for singly-linked list. 12 | * type ListNode struct { 13 | * Val int 14 | * Next *ListNode 15 | * } 16 | */ 17 | func deleteNode(node *ListNode) { 18 | node.Val = node.Next.Val 19 | node.Next = node.Next.Next 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0258.Add-Digits/258. Add Digits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func addDigits(num int) int { 4 | for num > 9 { 5 | cur := 0 6 | for num != 0 { 7 | cur += num % 10 8 | num /= 10 9 | } 10 | num = cur 11 | } 12 | return num 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0260.Single-Number-III/260. Single Number III.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func singleNumberIII(nums []int) []int { 4 | diff := 0 5 | for _, num := range nums { 6 | diff ^= num 7 | } 8 | // Get its last set bit (lsb) 9 | diff &= -diff 10 | res := []int{0, 0} // this array stores the two numbers we will return 11 | for _, num := range nums { 12 | if (num & diff) == 0 { // the bit is not set 13 | res[0] ^= num 14 | } else { // the bit is set 15 | res[1] ^= num 16 | } 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0263.Ugly-Number/263. Ugly Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isUgly(num int) bool { 4 | if num > 0 { 5 | for _, i := range []int{2, 3, 5} { 6 | for num%i == 0 { 7 | num /= i 8 | } 9 | } 10 | } 11 | return num == 1 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0264.Ugly-Number-II/264. Ugly Number II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func nthUglyNumber(n int) int { 4 | dp, p2, p3, p5 := make([]int, n+1), 1, 1, 1 5 | dp[0], dp[1] = 0, 1 6 | for i := 2; i <= n; i++ { 7 | x2, x3, x5 := dp[p2]*2, dp[p3]*3, dp[p5]*5 8 | dp[i] = min(min(x2, x3), x5) 9 | if dp[i] == x2 { 10 | p2++ 11 | } 12 | if dp[i] == x3 { 13 | p3++ 14 | } 15 | if dp[i] == x5 { 16 | p5++ 17 | } 18 | } 19 | return dp[n] 20 | } 21 | 22 | func min(a, b int) int { 23 | if a < b { 24 | return a 25 | } 26 | return b 27 | } 28 | -------------------------------------------------------------------------------- /leetcode/0268.Missing-Number/268. Missing Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func missingNumber(nums []int) int { 4 | xor, i := 0, 0 5 | for i = 0; i < len(nums); i++ { 6 | xor = xor ^ i ^ nums[i] 7 | } 8 | return xor ^ i 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0275.H-Index-II/275. H-Index II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func hIndex275(citations []int) int { 4 | low, high := 0, len(citations)-1 5 | for low <= high { 6 | mid := low + (high-low)>>1 7 | if len(citations)-mid > citations[mid] { 8 | low = mid + 1 9 | } else { 10 | high = mid - 1 11 | } 12 | } 13 | return len(citations) - low 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0283.Move-Zeroes/283. Move Zeroes.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func moveZeroes(nums []int) { 4 | if len(nums) == 0 { 5 | return 6 | } 7 | j := 0 8 | for i := 0; i < len(nums); i++ { 9 | if nums[i] != 0 { 10 | if i != j { 11 | nums[i], nums[j] = nums[j], nums[i] 12 | } 13 | j++ 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0284.Peeking-Iterator/284. Peeking Iterator_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func Test_Problem284(t *testing.T) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0303.Range-Sum-Query-Immutable/303. Range Sum Query - Immutable_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem303(t *testing.T) { 9 | obj := Constructor303([]int{-2, 0, 3, -5, 2, -1}) 10 | fmt.Printf("obj = %v\n", obj) 11 | fmt.Printf("SumRange(0,2) = %v\n", obj.SumRange(0, 2)) // return 1 12 | fmt.Printf("SumRange(2,5) = %v\n", obj.SumRange(2, 5)) // return -1 13 | fmt.Printf("SumRange(0,5) = %v\n", obj.SumRange(0, 5)) // return -3 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0304.Range-Sum-Query-2D-Immutable/304. Range Sum Query 2D - Immutable_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem304(t *testing.T) { 9 | obj := Constructor( 10 | [][]int{ 11 | {3, 0, 1, 4, 2}, 12 | {5, 6, 3, 2, 1}, 13 | {1, 2, 0, 1, 5}, 14 | {4, 1, 0, 1, 7}, 15 | {1, 0, 3, 0, 5}, 16 | }, 17 | ) 18 | fmt.Printf("obj = %v\n", obj.SumRegion(2, 1, 4, 3)) 19 | fmt.Printf("obj = %v\n", obj.SumRegion(1, 1, 2, 2)) 20 | fmt.Printf("obj = %v\n", obj.SumRegion(1, 2, 2, 4)) 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0319.Bulb-Switcher/319.Bulb Switcher.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func bulbSwitch(n int) int { 6 | return int(math.Sqrt(float64(n))) 7 | } 8 | -------------------------------------------------------------------------------- /leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree/331. Verify Preorder Serialization of a Binary Tree.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func isValidSerialization(preorder string) bool { 6 | nodes, diff := strings.Split(preorder, ","), 1 7 | for _, node := range nodes { 8 | diff-- 9 | if diff < 0 { 10 | return false 11 | } 12 | if node != "#" { 13 | diff += 2 14 | } 15 | } 16 | return diff == 0 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0338.Counting-Bits/338. Counting Bits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countBits(num int) []int { 4 | bits := make([]int, num+1) 5 | for i := 1; i <= num; i++ { 6 | bits[i] += bits[i&(i-1)] + 1 7 | } 8 | return bits 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0341.Flatten-Nested-List-Iterator/341. Flatten Nested List Iterator_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem338(t *testing.T) { 9 | obj := Constructor([]*NestedInteger{}) 10 | fmt.Printf("obj = %v\n", obj) 11 | fmt.Printf("obj = %v\n", obj.Next()) 12 | fmt.Printf("obj = %v\n", obj.HasNext()) 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0342.Power-of-Four/342. Power of Four.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 解法一 数论 4 | func isPowerOfFour(num int) bool { 5 | return num > 0 && (num&(num-1)) == 0 && (num-1)%3 == 0 6 | } 7 | 8 | // 解法二 循环 9 | func isPowerOfFour1(num int) bool { 10 | for num >= 4 { 11 | if num%4 == 0 { 12 | num = num / 4 13 | } else { 14 | return false 15 | } 16 | } 17 | return num == 1 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0343.Integer-Break/343. Integer Break.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func integerBreak(n int) int { 4 | dp := make([]int, n+1) 5 | dp[0], dp[1] = 1, 1 6 | for i := 1; i <= n; i++ { 7 | for j := 1; j < i; j++ { 8 | // dp[i] = max(dp[i], j * (i - j), j*dp[i-j]) 9 | dp[i] = max(dp[i], j*max(dp[i-j], i-j)) 10 | } 11 | } 12 | return dp[n] 13 | } 14 | 15 | func max(a int, b int) int { 16 | if a > b { 17 | return a 18 | } 19 | return b 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0344.Reverse-String/344. Reverse String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func reverseString(s []byte) { 4 | for i, j := 0, len(s)-1; i < j; { 5 | s[i], s[j] = s[j], s[i] 6 | i++ 7 | j-- 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0349.Intersection-of-Two-Arrays/349. Intersection of Two Arrays.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func intersection(nums1 []int, nums2 []int) []int { 4 | m := map[int]bool{} 5 | var res []int 6 | for _, n := range nums1 { 7 | m[n] = true 8 | } 9 | for _, n := range nums2 { 10 | if m[n] { 11 | delete(m, n) 12 | res = append(res, n) 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0350.Intersection-of-Two-Arrays-II/350. Intersection of Two Arrays II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func intersect(nums1 []int, nums2 []int) []int { 4 | m := map[int]int{} 5 | var res []int 6 | for _, n := range nums1 { 7 | m[n]++ 8 | } 9 | for _, n := range nums2 { 10 | if m[n] > 0 { 11 | res = append(res, n) 12 | m[n]-- 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0367.Valid-Perfect-Square/367. Valid Perfect Square.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isPerfectSquare(num int) bool { 4 | low, high := 1, num 5 | for low <= high { 6 | mid := low + (high-low)>>1 7 | if mid*mid == num { 8 | return true 9 | } else if mid*mid < num { 10 | low = mid + 1 11 | } else { 12 | high = mid - 1 13 | } 14 | } 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0371.Sum-of-Two-Integers/371. Sum of Two Integers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func getSum(a int, b int) int { 4 | if a == 0 { 5 | return b 6 | } 7 | if b == 0 { 8 | return a 9 | } 10 | // (a & b)<<1 计算的是进位 11 | // a ^ b 计算的是不带进位的加法 12 | return getSum((a&b)<<1, a^b) 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0376.Wiggle-Subsequence/376. Wiggle Subsequence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func wiggleMaxLength(nums []int) int { 4 | if len(nums) < 2 { 5 | return len(nums) 6 | } 7 | res := 1 8 | prevDiff := nums[1] - nums[0] 9 | if prevDiff != 0 { 10 | res = 2 11 | } 12 | for i := 2; i < len(nums); i++ { 13 | diff := nums[i] - nums[i-1] 14 | if diff > 0 && prevDiff <= 0 || diff < 0 && prevDiff >= 0 { 15 | res++ 16 | prevDiff = diff 17 | } 18 | } 19 | return res 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0383.Ransom-Note/383.Ransom Note.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canConstruct(ransomNote string, magazine string) bool { 4 | if len(ransomNote) > len(magazine) { 5 | return false 6 | } 7 | var cnt [26]int 8 | for _, v := range magazine { 9 | cnt[v-'a']++ 10 | } 11 | for _, v := range ransomNote { 12 | cnt[v-'a']-- 13 | if cnt[v-'a'] < 0 { 14 | return false 15 | } 16 | } 17 | return true 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0386.Lexicographical-Numbers/386. Lexicographical Numbers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func lexicalOrder(n int) []int { 4 | res := make([]int, 0, n) 5 | dfs386(1, n, &res) 6 | return res 7 | } 8 | 9 | func dfs386(x, n int, res *[]int) { 10 | limit := (x + 10) / 10 * 10 11 | for x <= n && x < limit { 12 | *res = append(*res, x) 13 | if x*10 <= n { 14 | dfs386(x*10, n, res) 15 | } 16 | x++ 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0389.Find-the-Difference/389. Find the Difference.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findTheDifference(s string, t string) byte { 4 | n, ch := len(t), t[len(t)-1] 5 | for i := 0; i < n-1; i++ { 6 | ch ^= s[i] 7 | ch ^= t[i] 8 | } 9 | return ch 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0390.Elimination-Game/390. Elimination Game.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func lastRemaining(n int) int { 4 | start, dir, step := 1, true, 1 5 | for n > 1 { 6 | if dir { // 正向 7 | start += step 8 | } else { // 反向 9 | if n%2 == 1 { 10 | start += step 11 | } 12 | } 13 | dir = !dir 14 | n >>= 1 15 | step <<= 1 16 | } 17 | return start 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0396.Rotate-Function/396. Rotate Function.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxRotateFunction(nums []int) int { 4 | n := len(nums) 5 | var sum, f int 6 | for i, num := range nums { 7 | sum += num 8 | f += i * num // F(0) 9 | } 10 | ans := f 11 | for i := 1; i < n; i++ { 12 | f += sum - n*nums[n-i] // F(i) = F(i-1) + sum - n*nums[n-i] 13 | if f > ans { 14 | ans = f 15 | } 16 | } 17 | return ans 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0397.Integer-Replacement/397. Integer Replacement.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func integerReplacement(n int) int { 4 | res := 0 5 | for n > 1 { 6 | if (n & 1) == 0 { // 判断是否是偶数 7 | n >>= 1 8 | } else if (n+1)%4 == 0 && n != 3 { // 末尾 2 位为 11 9 | n++ 10 | } else { // 末尾 2 位为 01 11 | n-- 12 | } 13 | res++ 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0400.Nth-Digit/400.Nth Digit.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func findNthDigit(n int) int { 6 | if n <= 9 { 7 | return n 8 | } 9 | bits := 1 10 | for n > 9*int(math.Pow10(bits-1))*bits { 11 | n -= 9 * int(math.Pow10(bits-1)) * bits 12 | bits++ 13 | } 14 | idx := n - 1 15 | start := int(math.Pow10(bits - 1)) 16 | num := start + idx/bits 17 | digitIdx := idx % bits 18 | return num / int(math.Pow10(bits-digitIdx-1)) % 10 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0402.Remove-K-Digits/402. Remove K Digits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removeKdigits(num string, k int) string { 4 | if k == len(num) { 5 | return "0" 6 | } 7 | res := []byte{} 8 | for i := 0; i < len(num); i++ { 9 | c := num[i] 10 | for k > 0 && len(res) > 0 && c < res[len(res)-1] { 11 | res = res[:len(res)-1] 12 | k-- 13 | } 14 | res = append(res, c) 15 | } 16 | res = res[:len(res)-k] 17 | 18 | // trim leading zeros 19 | for len(res) > 1 && res[0] == '0' { 20 | res = res[1:] 21 | } 22 | return string(res) 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/0404.Sum-of-Left-Leaves/README.md: -------------------------------------------------------------------------------- 1 | # [404. Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves/) 2 | 3 | 4 | ## 题目 5 | 6 | Find the sum of all left leaves in a given binary tree. 7 | 8 | **Example:** 9 | 10 | 3 11 | / \ 12 | 9 20 13 | / \ 14 | 15 7 15 | 16 | There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24. 17 | 18 | 19 | ## 题目大意 20 | 21 | 计算给定二叉树的所有左叶子之和。 22 | 23 | 24 | ## 解题思路 25 | 26 | 27 | - 这一题是微软的面试题。递归求解即可 28 | 29 | -------------------------------------------------------------------------------- /leetcode/0409.Longest-Palindrome/409. Longest Palindrome.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func longestPalindrome(s string) int { 4 | counter := make(map[rune]int) 5 | for _, r := range s { 6 | counter[r]++ 7 | } 8 | answer := 0 9 | for _, v := range counter { 10 | answer += v / 2 * 2 11 | if answer%2 == 0 && v%2 == 1 { 12 | answer++ 13 | } 14 | } 15 | return answer 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0412.Fizz-Buzz/412. Fizz Buzz.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strconv" 4 | 5 | func fizzBuzz(n int) []string { 6 | solution := make([]string, n) 7 | for i := 1; i <= n; i++ { 8 | solution[i-1] = "" 9 | if i%3 == 0 { 10 | solution[i-1] += "Fizz" 11 | } 12 | if i%5 == 0 { 13 | solution[i-1] += "Buzz" 14 | } 15 | if solution[i-1] == "" { 16 | solution[i-1] = strconv.Itoa(i) 17 | } 18 | } 19 | return solution 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0413.Arithmetic-Slices/413. Arithmetic Slices.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numberOfArithmeticSlices(A []int) int { 4 | if len(A) < 3 { 5 | return 0 6 | } 7 | res, dp := 0, 0 8 | for i := 1; i < len(A)-1; i++ { 9 | if A[i+1]-A[i] == A[i]-A[i-1] { 10 | dp++ 11 | res += dp 12 | } else { 13 | dp = 0 14 | } 15 | } 16 | return res 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0414.Third-Maximum-Number/414. Third Maximum Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "math" 5 | ) 6 | 7 | func thirdMax(nums []int) int { 8 | a, b, c := math.MinInt64, math.MinInt64, math.MinInt64 9 | for _, v := range nums { 10 | if v > a { 11 | c = b 12 | b = a 13 | a = v 14 | } else if v < a && v > b { 15 | c = b 16 | b = v 17 | } else if v < b && v > c { 18 | c = v 19 | } 20 | } 21 | if c == math.MinInt64 { 22 | return a 23 | } 24 | return c 25 | } 26 | -------------------------------------------------------------------------------- /leetcode/0416.Partition-Equal-Subset-Sum/416. Partition Equal Subset Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canPartition(nums []int) bool { 4 | sum := 0 5 | for _, v := range nums { 6 | sum += v 7 | } 8 | if sum%2 != 0 { 9 | return false 10 | } 11 | // C = half sum 12 | n, C, dp := len(nums), sum/2, make([]bool, sum/2+1) 13 | for i := 0; i <= C; i++ { 14 | dp[i] = (nums[0] == i) 15 | } 16 | for i := 1; i < n; i++ { 17 | for j := C; j >= nums[i]; j-- { 18 | dp[j] = dp[j] || dp[j-nums[i]] 19 | } 20 | } 21 | return dp[C] 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0419.Battleships-in-a-Board/419. Battleships in a Board.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countBattleships(board [][]byte) (ans int) { 4 | if len(board) == 0 || len(board[0]) == 0 { 5 | return 0 6 | } 7 | for i := range board { 8 | for j := range board[i] { 9 | if board[i][j] == 'X' { 10 | if i > 0 && board[i-1][j] == 'X' { 11 | continue 12 | } 13 | if j > 0 && board[i][j-1] == 'X' { 14 | continue 15 | } 16 | ans++ 17 | } 18 | } 19 | } 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0429.N-ary-Tree-Level-Order-Traversal/429. N-ary Tree Level Order Traversal_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem429(t *testing.T) { 9 | fmt.Printf("success\n") 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/0434.Number-of-Segments-in-a-String/434.Number of Segments in a String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countSegments(s string) int { 4 | segments := false 5 | cnt := 0 6 | for _, v := range s { 7 | if v == ' ' && segments { 8 | segments = false 9 | cnt += 1 10 | } else if v != ' ' { 11 | segments = true 12 | } 13 | } 14 | if segments { 15 | cnt++ 16 | } 17 | return cnt 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0441.Arranging-Coins/441. Arranging Coins.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | // 解法一 数学公式 6 | func arrangeCoins(n int) int { 7 | if n <= 0 { 8 | return 0 9 | } 10 | x := math.Sqrt(2*float64(n)+0.25) - 0.5 11 | return int(x) 12 | } 13 | 14 | // 解法二 模拟 15 | func arrangeCoins1(n int) int { 16 | k := 1 17 | for n >= k { 18 | n -= k 19 | k++ 20 | } 21 | return k - 1 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array/448. Find All Numbers Disappeared in an Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findDisappearedNumbers(nums []int) []int { 4 | res := []int{} 5 | for _, v := range nums { 6 | if v < 0 { 7 | v = -v 8 | } 9 | if nums[v-1] > 0 { 10 | nums[v-1] = -nums[v-1] 11 | } 12 | } 13 | for i, v := range nums { 14 | if v > 0 { 15 | res = append(res, i+1) 16 | } 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0453.Minimum-Moves-to-Equal-Array-Elements/453. Minimum Moves to Equal Array Elements.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func minMoves(nums []int) int { 6 | sum, min, l := 0, math.MaxInt32, len(nums) 7 | for _, v := range nums { 8 | sum += v 9 | if min > v { 10 | min = v 11 | } 12 | } 13 | return sum - min*l 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0454.4Sum-II/454. 4Sum II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func fourSumCount(A []int, B []int, C []int, D []int) int { 4 | m := make(map[int]int, len(A)*len(B)) 5 | for _, a := range A { 6 | for _, b := range B { 7 | m[a+b]++ 8 | } 9 | } 10 | ret := 0 11 | for _, c := range C { 12 | for _, d := range D { 13 | ret += m[0-c-d] 14 | } 15 | } 16 | 17 | return ret 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0455.Assign-Cookies/455. Assign Cookies.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func findContentChildren(g []int, s []int) int { 6 | sort.Ints(g) 7 | sort.Ints(s) 8 | gi, si, res := 0, 0, 0 9 | for gi < len(g) && si < len(s) { 10 | if s[si] >= g[gi] { 11 | res++ 12 | si++ 13 | gi++ 14 | } else { 15 | si++ 16 | } 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0458.Poor-Pigs/458.Poor Pigs.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func poorPigs(buckets int, minutesToDie int, minutesToTest int) int { 6 | base := minutesToTest/minutesToDie + 1 7 | return int(math.Ceil(math.Log10(float64(buckets)) / math.Log10(float64(base)))) 8 | } 9 | -------------------------------------------------------------------------------- /leetcode/0461.Hamming-Distance/461. Hamming Distance.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func hammingDistance(x int, y int) int { 4 | distance := 0 5 | for xor := x ^ y; xor != 0; xor &= (xor - 1) { 6 | distance++ 7 | } 8 | return distance 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/0462.Minimum-Moves-to-Equal-Array-Elements-II/462. Minimum Moves to Equal Array Elements II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "math" 5 | "sort" 6 | ) 7 | 8 | func minMoves2(nums []int) int { 9 | if len(nums) == 0 { 10 | return 0 11 | } 12 | moves, mid := 0, len(nums)/2 13 | sort.Ints(nums) 14 | for i := range nums { 15 | if i == mid { 16 | continue 17 | } 18 | moves += int(math.Abs(float64(nums[mid] - nums[i]))) 19 | } 20 | return moves 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0470.Implement-Rand10-Using-Rand7/470. Implement Rand10() Using Rand7().go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math/rand" 4 | 5 | func rand10() int { 6 | rand10 := 10 7 | for rand10 >= 10 { 8 | rand10 = (rand7() - 1) + rand7() 9 | } 10 | return rand10%10 + 1 11 | } 12 | 13 | func rand7() int { 14 | return rand.Intn(7) 15 | } 16 | 17 | func rand101() int { 18 | rand40 := 40 19 | for rand40 >= 40 { 20 | rand40 = (rand7()-1)*7 + rand7() - 1 21 | } 22 | return rand40%10 + 1 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/0483.Smallest-Good-Base/483. Smallest Good Base.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "math" 5 | "math/bits" 6 | "strconv" 7 | ) 8 | 9 | func smallestGoodBase(n string) string { 10 | nVal, _ := strconv.Atoi(n) 11 | mMax := bits.Len(uint(nVal)) - 1 12 | for m := mMax; m > 1; m-- { 13 | k := int(math.Pow(float64(nVal), 1/float64(m))) 14 | mul, sum := 1, 1 15 | for i := 0; i < m; i++ { 16 | mul *= k 17 | sum += mul 18 | } 19 | if sum == nVal { 20 | return strconv.Itoa(k) 21 | } 22 | } 23 | return strconv.Itoa(nVal - 1) 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0485.Max-Consecutive-Ones/485. Max Consecutive Ones.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findMaxConsecutiveOnes(nums []int) int { 4 | maxCount, currentCount := 0, 0 5 | for _, v := range nums { 6 | if v == 1 { 7 | currentCount++ 8 | } else { 9 | currentCount = 0 10 | } 11 | if currentCount > maxCount { 12 | maxCount = currentCount 13 | } 14 | } 15 | return maxCount 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0492.Construct-the-Rectangle/492.Construct the Rectangle.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func constructRectangle(area int) []int { 6 | ans := make([]int, 2) 7 | W := int(math.Sqrt(float64(area))) 8 | for W >= 1 { 9 | if area%W == 0 { 10 | ans[0], ans[1] = area/W, W 11 | break 12 | } 13 | W -= 1 14 | } 15 | return ans 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0495.Teemo-Attacking/495.Teemo Attacking.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findPoisonedDuration(timeSeries []int, duration int) int { 4 | var ans int 5 | for i := 1; i < len(timeSeries); i++ { 6 | t := timeSeries[i-1] 7 | end := t + duration - 1 8 | if end < timeSeries[i] { 9 | ans += duration 10 | } else { 11 | ans += timeSeries[i] - t 12 | } 13 | } 14 | ans += duration 15 | return ans 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0497.Random-Point-in-Non-overlapping-Rectangles/497. Random Point in Non-overlapping Rectangles_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem497(t *testing.T) { 9 | w := [][]int{{1, 1, 5, 5}} 10 | sol := Constructor497(w) 11 | fmt.Printf("1.Pick = %v\n", sol.Pick()) 12 | fmt.Printf("2.Pick = %v\n", sol.Pick()) 13 | fmt.Printf("3.Pick = %v\n", sol.Pick()) 14 | fmt.Printf("4.Pick = %v\n", sol.Pick()) 15 | fmt.Printf("5.Pick = %v\n", sol.Pick()) 16 | fmt.Printf("6.Pick = %v\n", sol.Pick()) 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0504.Base-7/504.Base 7.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strconv" 4 | 5 | func convertToBase7(num int) string { 6 | if num == 0 { 7 | return "0" 8 | } 9 | negative := false 10 | if num < 0 { 11 | negative = true 12 | num = -num 13 | } 14 | var ans string 15 | var nums []int 16 | for num != 0 { 17 | remainder := num % 7 18 | nums = append(nums, remainder) 19 | num = num / 7 20 | } 21 | if negative { 22 | ans += "-" 23 | } 24 | for i := len(nums) - 1; i >= 0; i-- { 25 | ans += strconv.Itoa(nums[i]) 26 | } 27 | return ans 28 | } 29 | -------------------------------------------------------------------------------- /leetcode/0518.Coin-Change-II/518. Coin Change II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func change(amount int, coins []int) int { 4 | dp := make([]int, amount+1) 5 | dp[0] = 1 6 | for _, coin := range coins { 7 | for i := coin; i <= amount; i++ { 8 | dp[i] += dp[i-coin] 9 | } 10 | } 11 | return dp[amount] 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0520.Detect-Capital/520.Detect Capital.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func detectCapitalUse(word string) bool { 6 | wLower := strings.ToLower(word) 7 | wUpper := strings.ToUpper(word) 8 | wCaptial := strings.ToUpper(string(word[0])) + strings.ToLower(string(word[1:])) 9 | if wCaptial == word || wLower == word || wUpper == word { 10 | return true 11 | } 12 | return false 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0523.Continuous-Subarray-Sum/523. Continuous Subarray Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func checkSubarraySum(nums []int, k int) bool { 4 | m := make(map[int]int) 5 | m[0] = -1 6 | sum := 0 7 | for i, n := range nums { 8 | sum += n 9 | if r, ok := m[sum%k]; ok { 10 | if i-2 >= r { 11 | return true 12 | } 13 | } else { 14 | m[sum%k] = i 15 | } 16 | } 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0524.Longest-Word-in-Dictionary-through-Deleting/524. Longest Word in Dictionary through Deleting.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findLongestWord(s string, d []string) string { 4 | res := "" 5 | for i := 0; i < len(d); i++ { 6 | pointS := 0 7 | pointD := 0 8 | for pointS < len(s) && pointD < len(d[i]) { 9 | if s[pointS] == d[i][pointD] { 10 | pointD++ 11 | } 12 | pointS++ 13 | } 14 | if pointD == len(d[i]) && (len(res) < len(d[i]) || (len(res) == len(d[i]) && res > d[i])) { 15 | res = d[i] 16 | } 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0525.Contiguous-Array/525. Contiguous Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findMaxLength(nums []int) int { 4 | dict := map[int]int{} 5 | dict[0] = -1 6 | count, res := 0, 0 7 | for i := 0; i < len(nums); i++ { 8 | if nums[i] == 0 { 9 | count-- 10 | } else { 11 | count++ 12 | } 13 | if idx, ok := dict[count]; ok { 14 | res = max(res, i-idx) 15 | } else { 16 | dict[count] = i 17 | } 18 | } 19 | return res 20 | } 21 | 22 | func max(a, b int) int { 23 | if a > b { 24 | return a 25 | } 26 | return b 27 | } 28 | -------------------------------------------------------------------------------- /leetcode/0532.K-diff-Pairs-in-an-Array/532. K-diff Pairs in an Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findPairs(nums []int, k int) int { 4 | if k < 0 || len(nums) == 0 { 5 | return 0 6 | } 7 | var count int 8 | m := make(map[int]int, len(nums)) 9 | for _, value := range nums { 10 | m[value]++ 11 | } 12 | for key := range m { 13 | if k == 0 && m[key] > 1 { 14 | count++ 15 | continue 16 | } 17 | if k > 0 && m[key+k] > 0 { 18 | count++ 19 | } 20 | } 21 | return count 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0535.Encode-and-Decode-TinyURL/535. Encode and Decode TinyURL_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem535(t *testing.T) { 9 | obj := Constructor() 10 | fmt.Printf("obj = %v\n", obj) 11 | e := obj.encode("https://leetcode.com/problems/design-tinyurl") 12 | fmt.Printf("obj encode = %v\n", e) 13 | d := obj.decode(e) 14 | fmt.Printf("obj decode = %v\n", d) 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0540.Single-Element-in-a-Sorted-Array/540.Single Element in a Sorted Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func singleNonDuplicate(nums []int) int { 4 | left, right := 0, len(nums)-1 5 | for left < right { 6 | mid := (left + right) / 2 7 | if mid%2 == 0 { 8 | if nums[mid] == nums[mid+1] { 9 | left = mid + 1 10 | } else { 11 | right = mid 12 | } 13 | } else { 14 | if nums[mid] == nums[mid-1] { 15 | left = mid + 1 16 | } else { 17 | right = mid 18 | } 19 | } 20 | } 21 | return nums[left] 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0551.Student-Attendance-Record-I/551.Student Attendance Record I.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func checkRecord(s string) bool { 4 | numsA, maxL, numsL := 0, 0, 0 5 | for _, v := range s { 6 | if v == 'L' { 7 | numsL++ 8 | } else { 9 | if numsL > maxL { 10 | maxL = numsL 11 | } 12 | numsL = 0 13 | if v == 'A' { 14 | numsA++ 15 | } 16 | } 17 | } 18 | if numsL > maxL { 19 | maxL = numsL 20 | } 21 | return numsA < 2 && maxL < 3 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/0554.Brick-Wall/554. Brick Wall.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func leastBricks(wall [][]int) int { 4 | m := make(map[int]int) 5 | for _, row := range wall { 6 | sum := 0 7 | for i := 0; i < len(row)-1; i++ { 8 | sum += row[i] 9 | m[sum]++ 10 | } 11 | } 12 | max := 0 13 | for _, v := range m { 14 | if v > max { 15 | max = v 16 | } 17 | } 18 | return len(wall) - max 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0557.Reverse-Words-in-a-String-III/557. Reverse Words in a String III.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func reverseWords(s string) string { 8 | ss := strings.Split(s, " ") 9 | for i, s := range ss { 10 | ss[i] = revers(s) 11 | } 12 | return strings.Join(ss, " ") 13 | } 14 | 15 | func revers(s string) string { 16 | bytes := []byte(s) 17 | i, j := 0, len(bytes)-1 18 | for i < j { 19 | bytes[i], bytes[j] = bytes[j], bytes[i] 20 | i++ 21 | j-- 22 | } 23 | return string(bytes) 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0560.Subarray-Sum-Equals-K/560. Subarray Sum Equals K.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func subarraySum(nums []int, k int) int { 4 | count, pre := 0, 0 5 | m := map[int]int{} 6 | m[0] = 1 7 | for i := 0; i < len(nums); i++ { 8 | pre += nums[i] 9 | if _, ok := m[pre-k]; ok { 10 | count += m[pre-k] 11 | } 12 | m[pre] += 1 13 | } 14 | return count 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0561.Array-Partition/561. Array Partition.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func arrayPairSum(nums []int) int { 4 | array := [20001]int{} 5 | for i := 0; i < len(nums); i++ { 6 | array[nums[i]+10000]++ 7 | } 8 | flag, sum := true, 0 9 | for i := 0; i < len(array); i++ { 10 | for array[i] > 0 { 11 | if flag { 12 | sum = sum + i - 10000 13 | } 14 | flag = !flag 15 | array[i]-- 16 | } 17 | } 18 | return sum 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0575.Distribute-Candies/575. Distribute Candies.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func distributeCandies(candies []int) int { 4 | n, m := len(candies), make(map[int]struct{}, len(candies)) 5 | for _, candy := range candies { 6 | m[candy] = struct{}{} 7 | } 8 | res := len(m) 9 | if n/2 < res { 10 | return n / 2 11 | } 12 | return res 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0594.Longest-Harmonious-Subsequence/594. Longest Harmonious Subsequence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findLHS(nums []int) int { 4 | if len(nums) < 2 { 5 | return 0 6 | } 7 | res := make(map[int]int, len(nums)) 8 | for _, num := range nums { 9 | if _, exist := res[num]; exist { 10 | res[num]++ 11 | continue 12 | } 13 | res[num] = 1 14 | } 15 | longest := 0 16 | for k, c := range res { 17 | if n, exist := res[k+1]; exist { 18 | if c+n > longest { 19 | longest = c + n 20 | } 21 | } 22 | } 23 | return longest 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0598.Range-Addition-II/598. Range Addition II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxCount(m int, n int, ops [][]int) int { 4 | minM, minN := m, n 5 | for _, op := range ops { 6 | minM = min(minM, op[0]) 7 | minN = min(minN, op[1]) 8 | } 9 | return minM * minN 10 | } 11 | 12 | func min(a, b int) int { 13 | if a < b { 14 | return a 15 | } 16 | return b 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0599.Minimum-Index-Sum-of-Two-Lists/599. Minimum Index Sum of Two Lists.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findRestaurant(list1 []string, list2 []string) []string { 4 | m, ans := make(map[string]int, len(list1)), []string{} 5 | for i, r := range list1 { 6 | m[r] = i 7 | } 8 | for j, r := range list2 { 9 | if _, ok := m[r]; ok { 10 | m[r] += j 11 | if len(ans) == 0 || m[r] == m[ans[0]] { 12 | ans = append(ans, r) 13 | } else if m[r] < m[ans[0]] { 14 | ans = []string{r} 15 | } 16 | } 17 | } 18 | return ans 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0605.Can-Place-Flowers/605. Can Place Flowers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canPlaceFlowers(flowerbed []int, n int) bool { 4 | lenth := len(flowerbed) 5 | for i := 0; i < lenth && n > 0; i += 2 { 6 | if flowerbed[i] == 0 { 7 | if i+1 == lenth || flowerbed[i+1] == 0 { 8 | n-- 9 | } else { 10 | i++ 11 | } 12 | } 13 | } 14 | if n == 0 { 15 | return true 16 | } 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0611.Valid-Triangle-Number/611. Valid Triangle Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func triangleNumber(nums []int) int { 6 | res := 0 7 | sort.Ints(nums) 8 | for i := 0; i < len(nums)-2; i++ { 9 | k := i + 2 10 | for j := i + 1; j < len(nums)-1 && nums[i] != 0; j++ { 11 | for k < len(nums) && nums[i]+nums[j] > nums[k] { 12 | k++ 13 | } 14 | res += k - j - 1 15 | } 16 | } 17 | return res 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0633.Sum-of-Square-Numbers/633. Sum of Square Numbers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math" 4 | 5 | func judgeSquareSum(c int) bool { 6 | low, high := 0, int(math.Sqrt(float64(c))) 7 | for low <= high { 8 | if low*low+high*high < c { 9 | low++ 10 | } else if low*low+high*high > c { 11 | high-- 12 | } else { 13 | return true 14 | } 15 | } 16 | return false 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0643.Maximum-Average-Subarray-I/643. Maximum Average Subarray I.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findMaxAverage(nums []int, k int) float64 { 4 | sum := 0 5 | for _, v := range nums[:k] { 6 | sum += v 7 | } 8 | maxSum := sum 9 | for i := k; i < len(nums); i++ { 10 | sum = sum - nums[i-k] + nums[i] 11 | maxSum = max(maxSum, sum) 12 | } 13 | return float64(maxSum) / float64(k) 14 | } 15 | 16 | func max(a, b int) int { 17 | if a > b { 18 | return a 19 | } 20 | return b 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0645.Set-Mismatch/645. Set Mismatch.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findErrorNums(nums []int) []int { 4 | m, res := make([]int, len(nums)), make([]int, 2) 5 | for _, n := range nums { 6 | if m[n-1] == 0 { 7 | m[n-1] = 1 8 | } else { 9 | res[0] = n 10 | } 11 | } 12 | for i := range m { 13 | if m[i] == 0 { 14 | res[1] = i + 1 15 | break 16 | } 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0647.Palindromic-Substrings/647. Palindromic Substrings.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countSubstrings(s string) int { 4 | res := 0 5 | for i := 0; i < len(s); i++ { 6 | res += countPalindrome(s, i, i) 7 | res += countPalindrome(s, i, i+1) 8 | } 9 | return res 10 | } 11 | 12 | func countPalindrome(s string, left, right int) int { 13 | res := 0 14 | for left >= 0 && right < len(s) { 15 | if s[left] != s[right] { 16 | break 17 | } 18 | left-- 19 | right++ 20 | res++ 21 | } 22 | return res 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/0665.Non-decreasing-Array/665. Non-decreasing Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func checkPossibility(nums []int) bool { 4 | count := 0 5 | for i := 0; i < len(nums)-1; i++ { 6 | if nums[i] > nums[i+1] { 7 | count++ 8 | if count > 1 { 9 | return false 10 | } 11 | if i > 0 && nums[i+1] < nums[i-1] { 12 | nums[i+1] = nums[i] 13 | } 14 | } 15 | } 16 | return true 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0667.Beautiful-Arrangement-II/667. Beautiful Arrangement II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func constructArray(n int, k int) []int { 4 | res := []int{} 5 | for i := 0; i < n-k-1; i++ { 6 | res = append(res, i+1) 7 | } 8 | for i := n - k; i < n-k+(k+1)/2; i++ { 9 | res = append(res, i) 10 | res = append(res, 2*n-k-i) 11 | } 12 | if k%2 == 0 { 13 | res = append(res, n-k+(k+1)/2) 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0674.Longest-Continuous-Increasing-Subsequence/674. Longest Continuous Increasing Subsequence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findLengthOfLCIS(nums []int) int { 4 | if len(nums) == 0 { 5 | return 0 6 | } 7 | res, length := 1, 1 8 | for i := 1; i < len(nums); i++ { 9 | if nums[i] > nums[i-1] { 10 | length++ 11 | } else { 12 | res = max(res, length) 13 | length = 1 14 | } 15 | } 16 | return max(res, length) 17 | } 18 | 19 | func max(a, b int) int { 20 | if a > b { 21 | return a 22 | } 23 | return b 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0677.Map-Sum-Pairs/677. Map Sum Pairs_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem677(t *testing.T) { 9 | obj := Constructor() 10 | fmt.Printf("obj = %v\n", obj) 11 | obj.Insert("apple", 3) 12 | fmt.Printf("obj = %v\n", obj) 13 | fmt.Printf("obj.sum = %v\n", obj.Sum("ap")) 14 | obj.Insert("app", 2) 15 | fmt.Printf("obj = %v\n", obj) 16 | fmt.Printf("obj.sum = %v\n", obj.Sum("ap")) 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0696.Count-Binary-Substrings/696. Count Binary Substrings.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countBinarySubstrings(s string) int { 4 | last, res := 0, 0 5 | for i := 0; i < len(s); { 6 | c, count := s[i], 1 7 | for i++; i < len(s) && s[i] == c; i++ { 8 | count++ 9 | } 10 | res += min(count, last) 11 | last = count 12 | } 13 | return res 14 | } 15 | 16 | func min(a, b int) int { 17 | if a < b { 18 | return a 19 | } 20 | return b 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0703.Kth-Largest-Element-in-a-Stream/703. Kth Largest Element in a Stream_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem703(t *testing.T) { 9 | obj := Constructor(3, []int{4, 5, 8, 2}) 10 | fmt.Printf("Add 7 = %v\n", obj.Add(3)) 11 | fmt.Printf("Add 7 = %v\n", obj.Add(5)) 12 | fmt.Printf("Add 7 = %v\n", obj.Add(10)) 13 | fmt.Printf("Add 7 = %v\n", obj.Add(9)) 14 | fmt.Printf("Add 7 = %v\n", obj.Add(4)) 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0704.Binary-Search/704. Binary Search.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func search704(nums []int, target int) int { 4 | low, high := 0, len(nums)-1 5 | for low <= high { 6 | mid := low + (high-low)>>1 7 | if nums[mid] == target { 8 | return mid 9 | } else if nums[mid] > target { 10 | high = mid - 1 11 | } else { 12 | low = mid + 1 13 | } 14 | } 15 | return -1 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0709.To-Lower-Case/709. To Lower Case.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func toLowerCase(s string) string { 4 | runes := []rune(s) 5 | diff := 'a' - 'A' 6 | for i := 0; i < len(s); i++ { 7 | if runes[i] >= 'A' && runes[i] <= 'Z' { 8 | runes[i] += diff 9 | } 10 | } 11 | return string(runes) 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isOneBitCharacter(bits []int) bool { 4 | var i int 5 | for i = 0; i < len(bits)-1; i++ { 6 | if bits[i] == 1 { 7 | i++ 8 | } 9 | } 10 | return i == len(bits)-1 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/0720.Longest-Word-in-Dictionary/720. Longest Word in Dictionary.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func longestWord(words []string) string { 8 | sort.Strings(words) 9 | mp := make(map[string]bool) 10 | var res string 11 | for _, word := range words { 12 | size := len(word) 13 | if size == 1 || mp[word[:size-1]] { 14 | if size > len(res) { 15 | res = word 16 | } 17 | mp[word] = true 18 | } 19 | } 20 | return res 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0724.Find-Pivot-Index/724. Find Pivot Index.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 2 * leftSum + num[i] = sum 4 | // 时间: O(n) 5 | // 空间: O(1) 6 | func pivotIndex(nums []int) int { 7 | if len(nums) <= 0 { 8 | return -1 9 | } 10 | var sum, leftSum int 11 | for _, num := range nums { 12 | sum += num 13 | } 14 | for index, num := range nums { 15 | if leftSum*2+num == sum { 16 | return index 17 | } 18 | leftSum += num 19 | } 20 | return -1 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0735.Asteroid-Collision/735. Asteroid Collision.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func asteroidCollision(asteroids []int) []int { 4 | res := []int{} 5 | for _, v := range asteroids { 6 | for len(res) != 0 && res[len(res)-1] > 0 && res[len(res)-1] < -v { 7 | res = res[:len(res)-1] 8 | } 9 | if len(res) == 0 || v > 0 || res[len(res)-1] < 0 { 10 | res = append(res, v) 11 | } else if v < 0 && res[len(res)-1] == -v { 12 | res = res[:len(res)-1] 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0744.Find-Smallest-Letter-Greater-Than-Target/744. Find Smallest Letter Greater Than Target.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func nextGreatestLetter(letters []byte, target byte) byte { 4 | low, high := 0, len(letters)-1 5 | for low <= high { 6 | mid := low + (high-low)>>1 7 | if letters[mid] > target { 8 | high = mid - 1 9 | } else { 10 | low = mid + 1 11 | } 12 | } 13 | find := letters[low%len(letters)] 14 | if find <= target { 15 | return letters[0] 16 | } 17 | return find 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0745.Prefix-and-Suffix-Search/745. Prefix and Suffix Search_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem745(t *testing.T) { 9 | obj := Constructor745([]string{"apple"}) 10 | fmt.Printf("obj = %v\n", obj) 11 | param1 := obj.F("a", "e") 12 | fmt.Printf("param_1 = %v obj = %v\n", param1, obj) 13 | param2 := obj.F("b", "") 14 | fmt.Printf("param_2 = %v obj = %v\n", param2, obj) 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0747.Largest-Number-At-Least-Twice-of-Others/747. Largest Number At Least Twice of Others.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func dominantIndex(nums []int) int { 4 | maxNum, flag, index := 0, false, 0 5 | for i, v := range nums { 6 | if v > maxNum { 7 | maxNum = v 8 | index = i 9 | } 10 | } 11 | for _, v := range nums { 12 | if v != maxNum && 2*v > maxNum { 13 | flag = true 14 | } 15 | } 16 | if flag { 17 | return -1 18 | } 19 | return index 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation/762. Prime Number of Set Bits in Binary Representation.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "math/bits" 4 | 5 | func countPrimeSetBits(L int, R int) int { 6 | counter := 0 7 | for i := L; i <= R; i++ { 8 | if isPrime(bits.OnesCount(uint(i))) { 9 | counter++ 10 | } 11 | } 12 | return counter 13 | } 14 | 15 | func isPrime(x int) bool { 16 | return x == 2 || x == 3 || x == 5 || x == 7 || x == 11 || x == 13 || x == 17 || x == 19 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isToeplitzMatrix(matrix [][]int) bool { 4 | rows, columns := len(matrix), len(matrix[0]) 5 | for i := 1; i < rows; i++ { 6 | for j := 1; j < columns; j++ { 7 | if matrix[i-1][j-1] != matrix[i][j] { 8 | return false 9 | } 10 | } 11 | } 12 | return true 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0775.Global-and-Local-Inversions/775. Global and Local Inversions.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isIdealPermutation(A []int) bool { 4 | for i := range A { 5 | if abs(A[i]-i) > 1 { 6 | return false 7 | } 8 | } 9 | return true 10 | } 11 | 12 | func abs(a int) int { 13 | if a < 0 { 14 | return -a 15 | } 16 | return a 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0781.Rabbits-in-Forest/781. Rabbits in Forest.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numRabbits(ans []int) int { 4 | total, m := 0, make(map[int]int) 5 | for _, v := range ans { 6 | if m[v] == 0 { 7 | m[v] += v 8 | total += v + 1 9 | } else { 10 | m[v]-- 11 | } 12 | } 13 | return total 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0791.Custom-Sort-String/791. Custom Sort String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func customSortString(order string, str string) string { 6 | magic := map[byte]int{} 7 | for i := range order { 8 | magic[order[i]] = i - 30 9 | } 10 | byteSlice := []byte(str) 11 | sort.Slice(byteSlice, func(i, j int) bool { 12 | return magic[byteSlice[i]] < magic[byteSlice[j]] 13 | }) 14 | return string(byteSlice) 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0795.Number-of-Subarrays-with-Bounded-Maximum/795. Number of Subarrays with Bounded Maximum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numSubarrayBoundedMax(nums []int, left int, right int) int { 4 | return getAnswerPerBound(nums, right) - getAnswerPerBound(nums, left-1) 5 | } 6 | 7 | func getAnswerPerBound(nums []int, bound int) int { 8 | res, count := 0, 0 9 | for _, num := range nums { 10 | if num <= bound { 11 | count++ 12 | } else { 13 | count = 0 14 | } 15 | res += count 16 | } 17 | return res 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0810.Chalkboard-XOR-Game/810. Chalkboard XOR Game.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func xorGame(nums []int) bool { 4 | if len(nums)%2 == 0 { 5 | return true 6 | } 7 | xor := 0 8 | for _, num := range nums { 9 | xor ^= num 10 | } 11 | return xor == 0 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0830.Positions-of-Large-Groups/830. Positions of Large Groups.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func largeGroupPositions(S string) [][]int { 4 | res, end := [][]int{}, 0 5 | for end < len(S) { 6 | start, str := end, S[end] 7 | for end < len(S) && S[end] == str { 8 | end++ 9 | } 10 | if end-start >= 3 { 11 | res = append(res, []int{start, end - 1}) 12 | } 13 | } 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0832.Flipping-an-Image/832. Flipping an Image.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func flipAndInvertImage(A [][]int) [][]int { 4 | for i := 0; i < len(A); i++ { 5 | for a, b := 0, len(A[i])-1; a < b; a, b = a+1, b-1 { 6 | A[i][a], A[i][b] = A[i][b], A[i][a] 7 | } 8 | for a := 0; a < len(A[i]); a++ { 9 | A[i][a] = (A[i][a] + 1) % 2 10 | } 11 | } 12 | return A 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0836.Rectangle-Overlap/836. Rectangle Overlap.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isRectangleOverlap(rec1 []int, rec2 []int) bool { 4 | return rec1[0] < rec2[2] && rec2[0] < rec1[2] && rec1[1] < rec2[3] && rec2[1] < rec1[3] 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/0841.Keys-and-Rooms/841. Keys and Rooms.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canVisitAllRooms(rooms [][]int) bool { 4 | visited := make(map[int]bool) 5 | visited[0] = true 6 | dfsVisitAllRooms(rooms, visited, 0) 7 | return len(rooms) == len(visited) 8 | } 9 | 10 | func dfsVisitAllRooms(es [][]int, visited map[int]bool, from int) { 11 | for _, to := range es[from] { 12 | if visited[to] { 13 | continue 14 | } 15 | visited[to] = true 16 | dfsVisitAllRooms(es, visited, to) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0846.Hand-of-Straights/846.Hand of Straights.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func isNStraightHand(hand []int, groupSize int) bool { 6 | mp := make(map[int]int) 7 | for _, v := range hand { 8 | mp[v] += 1 9 | } 10 | sort.Ints(hand) 11 | for _, num := range hand { 12 | if mp[num] == 0 { 13 | continue 14 | } 15 | for diff := 0; diff < groupSize; diff++ { 16 | if mp[num+diff] == 0 { 17 | return false 18 | } 19 | mp[num+diff] -= 1 20 | } 21 | } 22 | return true 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/0867.Transpose-Matrix/867. Transpose Matrix.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func transpose(A [][]int) [][]int { 4 | row, col, result := len(A), len(A[0]), make([][]int, len(A[0])) 5 | for i := range result { 6 | result[i] = make([]int, row) 7 | } 8 | for i := 0; i < row; i++ { 9 | for j := 0; j < col; j++ { 10 | result[j][i] = A[i][j] 11 | } 12 | } 13 | return result 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0877.Stone-Game/877. Stone Game.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func stoneGame(piles []int) bool { 4 | return true 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/0881.Boats-to-Save-People/881. Boats to Save People.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func numRescueBoats(people []int, limit int) int { 8 | sort.Ints(people) 9 | left, right, res := 0, len(people)-1, 0 10 | for left <= right { 11 | if left == right { 12 | res++ 13 | return res 14 | } 15 | if people[left]+people[right] <= limit { 16 | left++ 17 | right-- 18 | } else { 19 | right-- 20 | } 21 | res++ 22 | } 23 | return res 24 | } 25 | -------------------------------------------------------------------------------- /leetcode/0884.Uncommon-Words-from-Two-Sentences/884. Uncommon Words from Two Sentences.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func uncommonFromSentences(A string, B string) []string { 6 | m, res := map[string]int{}, []string{} 7 | for _, s := range []string{A, B} { 8 | for _, word := range strings.Split(s, " ") { 9 | m[word]++ 10 | } 11 | } 12 | for key := range m { 13 | if m[key] == 1 { 14 | res = append(res, key) 15 | } 16 | } 17 | return res 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0891.Sum-of-Subsequence-Widths/891. Sum of Subsequence Widths.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func sumSubseqWidths(A []int) int { 8 | sort.Ints(A) 9 | res, mod, n, p := 0, 1000000007, len(A), 1 10 | for i := 0; i < n; i++ { 11 | res = (res + (A[i]-A[n-1-i])*p) % mod 12 | p = (p << 1) % mod 13 | } 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards/914. X of a Kind in a Deck of Cards.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func hasGroupsSizeX(deck []int) bool { 4 | if len(deck) < 2 { 5 | return false 6 | } 7 | m, g := map[int]int{}, -1 8 | for _, d := range deck { 9 | m[d]++ 10 | } 11 | for _, v := range m { 12 | if g == -1 { 13 | g = v 14 | } else { 15 | g = gcd(g, v) 16 | } 17 | } 18 | return g >= 2 19 | } 20 | 21 | func gcd(a, b int) int { 22 | if a == 0 { 23 | return b 24 | } 25 | return gcd(b%a, a) 26 | } 27 | -------------------------------------------------------------------------------- /leetcode/0920.Number-of-Music-Playlists/920. Number of Music Playlists.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numMusicPlaylists(N int, L int, K int) int { 4 | dp, mod := make([][]int, L+1), 1000000007 5 | for i := 0; i < L+1; i++ { 6 | dp[i] = make([]int, N+1) 7 | } 8 | dp[0][0] = 1 9 | for i := 1; i <= L; i++ { 10 | for j := 1; j <= N; j++ { 11 | dp[i][j] = (dp[i-1][j-1] * (N - (j - 1))) % mod 12 | if j > K { 13 | dp[i][j] = (dp[i][j] + (dp[i-1][j]*(j-K))%mod) % mod 14 | } 15 | } 16 | } 17 | return dp[L][N] 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid/921. Minimum Add to Make Parentheses Valid.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minAddToMakeValid(S string) int { 4 | if len(S) == 0 { 5 | return 0 6 | } 7 | stack := make([]rune, 0) 8 | for _, v := range S { 9 | if v == '(' { 10 | stack = append(stack, v) 11 | } else if (v == ')') && len(stack) > 0 && stack[len(stack)-1] == '(' { 12 | stack = stack[:len(stack)-1] 13 | } else { 14 | stack = append(stack, v) 15 | } 16 | } 17 | return len(stack) 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/0922.Sort-Array-By-Parity-II/922. Sort Array By Parity II.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func sortArrayByParityII(A []int) []int { 4 | if len(A) == 0 || len(A)%2 != 0 { 5 | return []int{} 6 | } 7 | res := make([]int, len(A)) 8 | oddIndex := 1 9 | evenIndex := 0 10 | for i := 0; i < len(A); i++ { 11 | if A[i]%2 == 0 { 12 | res[evenIndex] = A[i] 13 | evenIndex += 2 14 | } else { 15 | res[oddIndex] = A[i] 16 | oddIndex += 2 17 | } 18 | } 19 | return res 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/0930.Binary-Subarrays-With-Sum/930. Binary Subarrays With Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "fmt" 4 | 5 | func numSubarraysWithSum(A []int, S int) int { 6 | freq, sum, res := make([]int, len(A)+1), 0, 0 7 | freq[0] = 1 8 | for _, v := range A { 9 | t := sum + v - S 10 | if t >= 0 { 11 | // 总和有多余的,需要减去 t,除去的方法有 freq[t] 种 12 | res += freq[t] 13 | } 14 | sum += v 15 | freq[sum]++ 16 | fmt.Printf("freq = %v sum = %v res = %v t = %v\n", freq, sum, res, t) 17 | } 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0933.Number-of-Recent-Calls/933. Number of Recent Calls_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem933(t *testing.T) { 9 | obj := Constructor933() 10 | fmt.Printf("obj = %v\n", obj) 11 | param1 := obj.Ping(1) 12 | fmt.Printf("param = %v\n", param1) 13 | param1 = obj.Ping(100) 14 | fmt.Printf("param = %v\n", param1) 15 | param1 = obj.Ping(3001) 16 | fmt.Printf("param = %v\n", param1) 17 | param1 = obj.Ping(3002) 18 | fmt.Printf("param = %v\n", param1) 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/0942.DI-String-Match/942. DI String Match.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func diStringMatch(S string) []int { 4 | result, maxNum, minNum, index := make([]int, len(S)+1), len(S), 0, 0 5 | for _, ch := range S { 6 | if ch == 'I' { 7 | result[index] = minNum 8 | minNum++ 9 | } else { 10 | result[index] = maxNum 11 | maxNum-- 12 | } 13 | index++ 14 | } 15 | result[index] = minNum 16 | return result 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/0946.Validate-Stack-Sequences/946. Validate Stack Sequences.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func validateStackSequences(pushed []int, popped []int) bool { 4 | stack, j, N := []int{}, 0, len(pushed) 5 | for _, x := range pushed { 6 | stack = append(stack, x) 7 | for len(stack) != 0 && j < N && stack[len(stack)-1] == popped[j] { 8 | stack = stack[0 : len(stack)-1] 9 | j++ 10 | } 11 | } 12 | return j == N 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/0961.N-Repeated-Element-in-Size-2N-Array/961. N-Repeated Element in Size 2N Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func repeatedNTimes(A []int) int { 4 | kv := make(map[int]struct{}) 5 | for _, val := range A { 6 | if _, ok := kv[val]; ok { 7 | return val 8 | } 9 | kv[val] = struct{}{} 10 | } 11 | return 0 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/0973.K-Closest-Points-to-Origin/973. K Closest Points to Origin.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | // KClosest define 6 | func KClosest(points [][]int, K int) [][]int { 7 | sort.Slice(points, func(i, j int) bool { 8 | return points[i][0]*points[i][0]+points[i][1]*points[i][1] < 9 | points[j][0]*points[j][0]+points[j][1]*points[j][1] 10 | }) 11 | ans := make([][]int, K) 12 | for i := 0; i < K; i++ { 13 | ans[i] = points[i] 14 | } 15 | return ans 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0981.Time-Based-Key-Value-Store/981. Time Based Key-Value Store_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem981(t *testing.T) { 9 | obj := Constructor981() 10 | obj.Set("foo", "bar", 1) 11 | fmt.Printf("Get = %v\n", obj.Get("foo", 1)) 12 | fmt.Printf("Get = %v\n", obj.Get("foo", 3)) 13 | obj.Set("foo", "bar2", 4) 14 | fmt.Printf("Get = %v\n", obj.Get("foo", 4)) 15 | fmt.Printf("Get = %v\n", obj.Get("foo", 5)) 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/0985.Sum-of-Even-Numbers-After-Queries/985. Sum of Even Numbers After Queries.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func sumEvenAfterQueries(A []int, queries [][]int) []int { 4 | cur, res := 0, []int{} 5 | for _, v := range A { 6 | if v%2 == 0 { 7 | cur += v 8 | } 9 | } 10 | for _, q := range queries { 11 | if A[q[1]]%2 == 0 { 12 | cur -= A[q[1]] 13 | } 14 | A[q[1]] += q[0] 15 | if A[q[1]]%2 == 0 { 16 | cur += A[q[1]] 17 | } 18 | res = append(res, cur) 19 | } 20 | return res 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/0991.Broken-Calculator/991. Broken Calculator.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func brokenCalc(X int, Y int) int { 4 | res := 0 5 | for Y > X { 6 | res++ 7 | if Y&1 == 1 { 8 | Y++ 9 | } else { 10 | Y /= 2 11 | } 12 | } 13 | return res + X - Y 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/0997.Find-the-Town-Judge/997.Find the Town Judge.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findJudge(n int, trust [][]int) int { 4 | if n == 1 && len(trust) == 0 { 5 | return 1 6 | } 7 | judges := make(map[int]int) 8 | for _, v := range trust { 9 | judges[v[1]] += 1 10 | } 11 | for _, v := range trust { 12 | if _, ok := judges[v[0]]; ok { 13 | delete(judges, v[0]) 14 | } 15 | } 16 | for k, v := range judges { 17 | if v == n-1 { 18 | return k 19 | } 20 | } 21 | return -1 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations/1005. Maximize Sum Of Array After K Negations.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func largestSumAfterKNegations(A []int, K int) int { 8 | sort.Ints(A) 9 | minIdx := 0 10 | for i := 0; i < K; i++ { 11 | A[minIdx] = -A[minIdx] 12 | if A[minIdx+1] < A[minIdx] { 13 | minIdx++ 14 | } 15 | } 16 | sum := 0 17 | for _, a := range A { 18 | sum += a 19 | } 20 | return sum 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/1006.Clumsy-Factorial/1006. Clumsy Factorial.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func clumsy(N int) int { 4 | res, count, tmp, flag := 0, 1, N, false 5 | for i := N - 1; i > 0; i-- { 6 | count = count % 4 7 | switch count { 8 | case 1: 9 | tmp = tmp * i 10 | case 2: 11 | tmp = tmp / i 12 | case 3: 13 | res = res + tmp 14 | flag = true 15 | tmp = -1 16 | res = res + i 17 | case 0: 18 | flag = false 19 | tmp = tmp * (i) 20 | } 21 | count++ 22 | } 23 | if !flag { 24 | res = res + tmp 25 | } 26 | return res 27 | } 28 | -------------------------------------------------------------------------------- /leetcode/1009.Complement-of-Base-10-Integer/1009. Complement of Base 10 Integer.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func bitwiseComplement(n int) int { 4 | mask := 1 5 | for mask < n { 6 | mask = (mask << 1) + 1 7 | } 8 | return mask ^ n 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/1010.Pairs-of-Songs-With-Total-Durations-Divisible-by-60/1010. Pairs of Songs With Total Durations Divisible by 60.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numPairsDivisibleBy60(time []int) int { 4 | counts := make([]int, 60) 5 | for _, v := range time { 6 | v %= 60 7 | counts[v]++ 8 | } 9 | res := 0 10 | for i := 1; i < len(counts)/2; i++ { 11 | res += counts[i] * counts[60-i] 12 | } 13 | res += (counts[0] * (counts[0] - 1)) / 2 14 | res += (counts[30] * (counts[30] - 1)) / 2 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1017.Convert-to-Base-2/1017. Convert to Base -2.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strconv" 4 | 5 | func baseNeg2(N int) string { 6 | if N == 0 { 7 | return "0" 8 | } 9 | res := "" 10 | for N != 0 { 11 | remainder := N % (-2) 12 | N = N / (-2) 13 | if remainder < 0 { 14 | remainder += 2 15 | N++ 16 | } 17 | res = strconv.Itoa(remainder) + res 18 | } 19 | return res 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/1018.Binary-Prefix-Divisible-By-5/1018. Binary Prefix Divisible By 5.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func prefixesDivBy5(a []int) []bool { 4 | res, num := make([]bool, len(a)), 0 5 | for i, v := range a { 6 | num = (num<<1 | v) % 5 7 | res[i] = num == 0 8 | } 9 | return res 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1025.Divisor-Game/1025. Divisor Game.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func divisorGame(N int) bool { 4 | return N%2 == 0 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/1037.Valid-Boomerang/1037. Valid Boomerang.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func isBoomerang(points [][]int) bool { 4 | return (points[0][0]-points[1][0])*(points[0][1]-points[2][1]) != (points[0][0]-points[2][0])*(points[0][1]-points[1][1]) 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/1047.Remove-All-Adjacent-Duplicates-In-String/1047. Remove All Adjacent Duplicates In String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removeDuplicates1047(S string) string { 4 | stack := []rune{} 5 | for _, s := range S { 6 | if len(stack) == 0 || len(stack) > 0 && stack[len(stack)-1] != s { 7 | stack = append(stack, s) 8 | } else { 9 | stack = stack[:len(stack)-1] 10 | } 11 | } 12 | return string(stack) 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1051.Height-Checker/1051. Height Checker.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func heightChecker(heights []int) int { 6 | result, checker := 0, []int{} 7 | checker = append(checker, heights...) 8 | sort.Ints(checker) 9 | for i := 0; i < len(heights); i++ { 10 | if heights[i] != checker[i] { 11 | result++ 12 | } 13 | } 14 | return result 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1078.Occurrences-After-Bigram/1078. Occurrences After Bigram.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func findOcurrences(text string, first string, second string) []string { 6 | var res []string 7 | words := strings.Split(text, " ") 8 | if len(words) < 3 { 9 | return []string{} 10 | } 11 | for i := 2; i < len(words); i++ { 12 | if words[i-2] == first && words[i-1] == second { 13 | res = append(res, words[i]) 14 | } 15 | } 16 | return res 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1089.Duplicate-Zeros/1089. Duplicate Zeros.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func duplicateZeros(arr []int) { 4 | for i := 0; i < len(arr); i++ { 5 | if arr[i] == 0 && i+1 < len(arr) { 6 | arr = append(arr[:i+1], arr[i:len(arr)-1]...) 7 | i++ 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1108.Defanging-an-IP-Address/1108. Defanging an IP Address.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func defangIPaddr(address string) string { 6 | return strings.Replace(address, ".", "[.]", -1) 7 | } 8 | -------------------------------------------------------------------------------- /leetcode/1137.N-th-Tribonacci-Number/1137. N-th Tribonacci Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func tribonacci(n int) int { 4 | if n < 2 { 5 | return n 6 | } 7 | trib, prev, prev2 := 1, 1, 0 8 | for n > 2 { 9 | trib, prev, prev2 = trib+prev+prev2, trib, prev 10 | n-- 11 | } 12 | return trib 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1154.Day-of-the-Year/1154. Day of the Year.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "time" 4 | 5 | func dayOfYear(date string) int { 6 | first := date[:4] + "-01-01" 7 | firstDay, _ := time.Parse("2006-01-02", first) 8 | dateDay, _ := time.Parse("2006-01-02", date) 9 | duration := dateDay.Sub(firstDay) 10 | return int(duration.Hours())/24 + 1 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/1157.Online-Majority-Element-In-Subarray/1157. Online Majority Element In Subarray_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem1157(t *testing.T) { 9 | arr := []int{1, 1, 2, 2, 1, 1} 10 | obj := Constructor1157(arr) 11 | fmt.Printf("obj = %v\n", obj) 12 | fmt.Printf("query(0,5,4) = %v\n", obj.Query(0, 5, 4)) //1 13 | fmt.Printf("query(0,3,3) = %v\n", obj.Query(0, 3, 3)) //-1 14 | fmt.Printf("query(2,3,2) = %v\n", obj.Query(2, 3, 2)) //2 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1185.Day-of-the-Week/1185. Day of the Week.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "time" 4 | 5 | func dayOfTheWeek(day int, month int, year int) string { 6 | return time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.Local).Weekday().String() 7 | } 8 | -------------------------------------------------------------------------------- /leetcode/1207.Unique-Number-of-Occurrences/1207. Unique Number of Occurrences.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func uniqueOccurrences(arr []int) bool { 4 | freq, m := map[int]int{}, map[int]bool{} 5 | for _, v := range arr { 6 | freq[v]++ 7 | } 8 | for _, v := range freq { 9 | if _, ok := m[v]; !ok { 10 | m[v] = true 11 | } else { 12 | return false 13 | } 14 | } 15 | return true 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position/1217. Minimum Cost to Move Chips to The Same Position.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minCostToMoveChips(chips []int) int { 4 | odd, even := 0, 0 5 | for _, c := range chips { 6 | if c%2 == 0 { 7 | even++ 8 | } else { 9 | odd++ 10 | } 11 | } 12 | return min(odd, even) 13 | } 14 | 15 | func min(a int, b int) int { 16 | if a > b { 17 | return b 18 | } 19 | return a 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/1221.Split-a-String-in-Balanced-Strings/1221. Split a String in Balanced Strings.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func balancedStringSplit(s string) int { 4 | count, res := 0, 0 5 | for _, r := range s { 6 | if r == 'R' { 7 | count++ 8 | } else { 9 | count-- 10 | } 11 | if count == 0 { 12 | res++ 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1232.Check-If-It-Is-a-Straight-Line/1232. Check If It Is a Straight Line.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func checkStraightLine(coordinates [][]int) bool { 4 | dx0 := coordinates[1][0] - coordinates[0][0] 5 | dy0 := coordinates[1][1] - coordinates[0][1] 6 | for i := 1; i < len(coordinates)-1; i++ { 7 | dx := coordinates[i+1][0] - coordinates[i][0] 8 | dy := coordinates[i+1][1] - coordinates[i][1] 9 | if dy*dx0 != dy0*dx { // check cross product 10 | return false 11 | } 12 | } 13 | return true 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/1260.Shift-2D-Grid/1260. Shift 2D Grid.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func shiftGrid(grid [][]int, k int) [][]int { 4 | x, y := len(grid[0]), len(grid) 5 | newGrid := make([][]int, y) 6 | for i := 0; i < y; i++ { 7 | newGrid[i] = make([]int, x) 8 | } 9 | for i := 0; i < y; i++ { 10 | for j := 0; j < x; j++ { 11 | ny := (k / x) + i 12 | if (j + (k % x)) >= x { 13 | ny++ 14 | } 15 | newGrid[ny%y][(j+(k%x))%x] = grid[i][j] 16 | } 17 | } 18 | return newGrid 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/1266.Minimum-Time-Visiting-All-Points/1266. Minimum Time Visiting All Points.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minTimeToVisitAllPoints(points [][]int) int { 4 | res := 0 5 | for i := 1; i < len(points); i++ { 6 | res += max(abs(points[i][0]-points[i-1][0]), abs(points[i][1]-points[i-1][1])) 7 | } 8 | return res 9 | } 10 | 11 | func max(a int, b int) int { 12 | if a > b { 13 | return a 14 | } 15 | return b 16 | } 17 | 18 | func abs(a int) int { 19 | if a > 0 { 20 | return a 21 | } 22 | return -a 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer/1281. Subtract the Product and Sum of Digits of an Integer.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func subtractProductAndSum(n int) int { 4 | sum, product := 0, 1 5 | for ; n > 0; n /= 10 { 6 | sum += n % 10 7 | product *= n % 10 8 | } 9 | return product - sum 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array/1287. Element Appearing More Than 25% In Sorted Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findSpecialInteger(arr []int) int { 4 | n := len(arr) 5 | for i := 0; i < n-n/4; i++ { 6 | if arr[i] == arr[i+n/4] { 7 | return arr[i] 8 | } 9 | } 10 | return -1 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/1295.Find-Numbers-with-Even-Number-of-Digits/1295. Find Numbers with Even Number of Digits.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strconv" 4 | 5 | func findNumbers(nums []int) int { 6 | res := 0 7 | for _, n := range nums { 8 | res += 1 - len(strconv.Itoa(n))%2 9 | } 10 | return res 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side/1299. Replace Elements with Greatest Element on Right Side.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func replaceElements(arr []int) []int { 4 | j, temp := -1, 0 5 | for i := len(arr) - 1; i >= 0; i-- { 6 | temp = arr[i] 7 | arr[i] = j 8 | j = max(j, temp) 9 | } 10 | return arr 11 | } 12 | 13 | func max(a int, b int) int { 14 | if a > b { 15 | return a 16 | } 17 | return b 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero/1304. Find N Unique Integers Sum up to Zero.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func sumZero(n int) []int { 4 | res, left, right, start := make([]int, n), 0, n-1, 1 5 | for left < right { 6 | res[left] = start 7 | res[right] = -start 8 | start++ 9 | left = left + 1 10 | right = right - 1 11 | } 12 | return res 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1306.Jump-Game-III/1306. Jump Game III.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func canReach(arr []int, start int) bool { 4 | if start >= 0 && start < len(arr) && arr[start] < len(arr) { 5 | jump := arr[start] 6 | arr[start] += len(arr) 7 | return jump == 0 || canReach(arr, start+jump) || canReach(arr, start-jump) 8 | } 9 | return false 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1310.XOR-Queries-of-a-Subarray/1310. XOR Queries of a Subarray.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func xorQueries(arr []int, queries [][]int) []int { 4 | xors := make([]int, len(arr)) 5 | xors[0] = arr[0] 6 | for i := 1; i < len(arr); i++ { 7 | xors[i] = arr[i] ^ xors[i-1] 8 | } 9 | res := make([]int, len(queries)) 10 | for i, q := range queries { 11 | res[i] = xors[q[1]] 12 | if q[0] > 0 { 13 | res[i] ^= xors[q[0]-1] 14 | } 15 | } 16 | return res 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1313.Decompress-Run-Length-Encoded-List/1313. Decompress Run-Length Encoded List.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func decompressRLElist(nums []int) []int { 4 | res := []int{} 5 | for i := 0; i < len(nums); i += 2 { 6 | for j := 0; j < nums[i]; j++ { 7 | res = append(res, nums[i+1]) 8 | } 9 | } 10 | return res 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers/1317. Convert Integer to the Sum of Two No-Zero Integers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func getNoZeroIntegers(n int) []int { 4 | noZeroPair := []int{} 5 | for i := 1; i <= n/2; i++ { 6 | if isNoZero(i) && isNoZero(n-i) { 7 | noZeroPair = append(noZeroPair, []int{i, n - i}...) 8 | break 9 | } 10 | } 11 | return noZeroPair 12 | } 13 | 14 | func isNoZero(n int) bool { 15 | for n != 0 { 16 | if n%10 == 0 { 17 | return false 18 | } 19 | n /= 10 20 | } 21 | return true 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/1332.Remove-Palindromic-Subsequences/1332. Remove Palindromic Subsequences.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removePalindromeSub(s string) int { 4 | if len(s) == 0 { 5 | return 0 6 | } 7 | for i := 0; i < len(s)/2; i++ { 8 | if s[i] != s[len(s)-1-i] { 9 | return 2 10 | } 11 | } 12 | return 1 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1337.The-K-Weakest-Rows-in-a-Matrix/1337. The K Weakest Rows in a Matrix.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func kWeakestRows(mat [][]int, k int) []int { 4 | res := []int{} 5 | for j := 0; j < len(mat[0]); j++ { 6 | for i := 0; i < len(mat); i++ { 7 | if mat[i][j] == 0 && ((j == 0) || (mat[i][j-1] != 0)) { 8 | res = append(res, i) 9 | } 10 | } 11 | } 12 | for i := 0; i < len(mat); i++ { 13 | if mat[i][len(mat[0])-1] == 1 { 14 | res = append(res, i) 15 | } 16 | } 17 | return res[:k] 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays/1385. Find the Distance Value Between Two Arrays.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findTheDistanceValue(arr1 []int, arr2 []int, d int) int { 4 | res := 0 5 | for i := range arr1 { 6 | for j := range arr2 { 7 | if abs(arr1[i]-arr2[j]) <= d { 8 | break 9 | } 10 | if j == len(arr2)-1 { 11 | res++ 12 | } 13 | } 14 | } 15 | return res 16 | } 17 | 18 | func abs(a int) int { 19 | if a < 0 { 20 | return -1 * a 21 | } 22 | return a 23 | } 24 | -------------------------------------------------------------------------------- /leetcode/1389.Create-Target-Array-in-the-Given-Order/1389. Create Target Array in the Given Order.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func createTargetArray(nums []int, index []int) []int { 4 | result := make([]int, len(nums)) 5 | for i, pos := range index { 6 | copy(result[pos+1:i+1], result[pos:i]) 7 | result[pos] = nums[i] 8 | } 9 | return result 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1437.Check-If-All-1s-Are-at-Least-Length-K-Places-Away/1437. Check If All 1s Are at Least Length K Places Away.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func kLengthApart(nums []int, k int) bool { 4 | prevIndex := -1 5 | for i, num := range nums { 6 | if num == 1 { 7 | if prevIndex != -1 && i-prevIndex-1 < k { 8 | return false 9 | } 10 | prevIndex = i 11 | } 12 | } 13 | return true 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/1446.Consecutive-Characters/1446.Consecutive Characters.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxPower(s string) int { 4 | cur, cnt, ans := s[0], 1, 1 5 | for i := 1; i < len(s); i++ { 6 | if cur == s[i] { 7 | cnt++ 8 | } else { 9 | if cnt > ans { 10 | ans = cnt 11 | } 12 | cur = s[i] 13 | cnt = 1 14 | } 15 | } 16 | if cnt > ans { 17 | ans = cnt 18 | } 19 | return ans 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func isPrefixOfWord(sentence string, searchWord string) int { 6 | for i, v := range strings.Split(sentence, " ") { 7 | if strings.HasPrefix(v, searchWord) { 8 | return i + 1 9 | } 10 | } 11 | return -1 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array/1464. Maximum Product of Two Elements in an Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxProduct(nums []int) int { 4 | max1, max2 := 0, 0 5 | for _, num := range nums { 6 | if num >= max1 { 7 | max2 = max1 8 | max1 = num 9 | } else if num <= max1 && num >= max2 { 10 | max2 = num 11 | } 12 | } 13 | return (max1 - 1) * (max2 - 1) 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/1470.Shuffle-the-Array/1470. Shuffle the Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func shuffle(nums []int, n int) []int { 4 | result := make([]int, 0) 5 | for i := 0; i < n; i++ { 6 | result = append(result, nums[i]) 7 | result = append(result, nums[n+i]) 8 | } 9 | return result 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1480.Running-Sum-of-1d-Array/1480. Running Sum of 1d Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func runningSum(nums []int) []int { 4 | dp := make([]int, len(nums)+1) 5 | dp[0] = 0 6 | for i := 1; i <= len(nums); i++ { 7 | dp[i] = dp[i-1] + nums[i-1] 8 | } 9 | return dp[1:] 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1486.XOR-Operation-in-an-Array/1486. XOR Operation in an Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func xorOperation(n int, start int) int { 4 | res := 0 5 | for i := 0; i < n; i++ { 6 | res ^= start + 2*i 7 | } 8 | return res 9 | } 10 | -------------------------------------------------------------------------------- /leetcode/1512.Number-of-Good-Pairs/1512. Number of Good Pairs.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numIdenticalPairs(nums []int) int { 4 | total := 0 5 | for x := 0; x < len(nums); x++ { 6 | for y := x + 1; y < len(nums); y++ { 7 | if nums[x] == nums[y] { 8 | total++ 9 | } 10 | } 11 | } 12 | return total 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1518.Water-Bottles/1518.Water Bottles.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func numWaterBottles(numBottles int, numExchange int) int { 4 | if numBottles < numExchange { 5 | return numBottles 6 | } 7 | quotient := numBottles / numExchange 8 | reminder := numBottles % numExchange 9 | ans := numBottles + quotient 10 | for quotient+reminder >= numExchange { 11 | quotient, reminder = (quotient+reminder)/numExchange, (quotient+reminder)%numExchange 12 | ans += quotient 13 | } 14 | return ans 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1539.Kth-Missing-Positive-Number/1539. Kth Missing Positive Number.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findKthPositive(arr []int, k int) int { 4 | positive, index := 1, 0 5 | for index < len(arr) { 6 | if arr[index] != positive { 7 | k-- 8 | } else { 9 | index++ 10 | } 11 | if k == 0 { 12 | break 13 | } 14 | positive++ 15 | } 16 | if k != 0 { 17 | positive += k - 1 18 | } 19 | return positive 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/1551.Minimum-Operations-to-Make-Array-Equal/1551. Minimum Operations to Make Array Equal.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minOperations(n int) int { 4 | return n * n / 4 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/1572.Matrix-Diagonal-Sum/1572.Matrix Diagonal Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func diagonalSum(mat [][]int) int { 4 | n := len(mat) 5 | ans := 0 6 | for pi := 0; pi < n; pi++ { 7 | ans += mat[pi][pi] 8 | } 9 | for si, sj := n-1, 0; sj < n; si, sj = si-1, sj+1 { 10 | ans += mat[si][sj] 11 | } 12 | if n%2 == 0 { 13 | return ans 14 | } 15 | return ans - mat[n/2][n/2] 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1576.Replace-All-s-to-Avoid-Consecutive-Repeating-Characters/1576. Replace-All-s-to-Avoid-Consecutive-Repeating-Characters.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func modifyString(s string) string { 4 | res := []byte(s) 5 | for i, ch := range res { 6 | if ch == '?' { 7 | for b := byte('a'); b <= 'z'; b++ { 8 | if !(i > 0 && res[i-1] == b || i < len(res)-1 && res[i+1] == b) { 9 | res[i] = b 10 | break 11 | } 12 | } 13 | } 14 | } 15 | return string(res) 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1603.Design-Parking-System/1603. Design Parking System_test.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_Problem1603(t *testing.T) { 9 | obj := Constructor(1, 1, 0) 10 | fmt.Printf("obj = %v\n", obj) 11 | fmt.Printf("obj = %v\n", obj.AddCar(1)) 12 | fmt.Printf("obj = %v\n", obj.AddCar(2)) 13 | fmt.Printf("obj = %v\n", obj.AddCar(3)) 14 | fmt.Printf("obj = %v\n", obj.AddCar(1)) 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X/1608. Special Array With X Elements Greater Than or Equal X.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func specialArray(nums []int) int { 6 | sort.Ints(nums) 7 | x := len(nums) 8 | for _, num := range nums { 9 | if num >= x { 10 | return x 11 | } 12 | x-- 13 | if num >= x { 14 | return -1 15 | } 16 | } 17 | return -1 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1614.Maximum-Nesting-Depth-of-the-Parentheses/1614. Maximum Nesting Depth of the Parentheses.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maxDepth(s string) int { 4 | res, cur := 0, 0 5 | for _, c := range s { 6 | if c == '(' { 7 | cur++ 8 | res = max(res, cur) 9 | } else if c == ')' { 10 | cur-- 11 | } 12 | } 13 | return res 14 | } 15 | 16 | func max(a, b int) int { 17 | if a > b { 18 | return a 19 | } 20 | return b 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/1619.Mean-of-Array-After-Removing-Some-Elements/1619. Mean of Array After Removing Some Elements.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func trimMean(arr []int) float64 { 6 | sort.Ints(arr) 7 | n, sum := len(arr), 0 8 | for i := n / 20; i < n-(n/20); i++ { 9 | sum += arr[i] 10 | } 11 | return float64(sum) / float64((n - (n / 10))) 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/1624.Largest-Substring-Between-Two-Equal-Characters/1624. Largest Substring Between Two Equal Characters.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "strings" 4 | 5 | func maxLengthBetweenEqualCharacters(s string) int { 6 | res := -1 7 | for k, v := range s { 8 | tmp := strings.LastIndex(s, string(v)) 9 | if tmp > 0 { 10 | if res < tmp-k-1 { 11 | res = tmp - k - 1 12 | } 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1629.Slowest-Key/1629. Slowest Key.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func slowestKey(releaseTimes []int, keysPressed string) byte { 4 | longestDuration, key := releaseTimes[0], keysPressed[0] 5 | for i := 1; i < len(releaseTimes); i++ { 6 | duration := releaseTimes[i] - releaseTimes[i-1] 7 | if duration > longestDuration { 8 | longestDuration = duration 9 | key = keysPressed[i] 10 | } else if duration == longestDuration && keysPressed[i] > key { 11 | key = keysPressed[i] 12 | } 13 | } 14 | return key 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1636.Sort-Array-by-Increasing-Frequency/1636. Sort Array by Increasing Frequency.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func frequencySort(nums []int) []int { 6 | freq := map[int]int{} 7 | for _, v := range nums { 8 | freq[v]++ 9 | } 10 | sort.Slice(nums, func(i, j int) bool { 11 | if freq[nums[i]] == freq[nums[j]] { 12 | return nums[j] < nums[i] 13 | } 14 | return freq[nums[i]] < freq[nums[j]] 15 | }) 16 | return nums 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1646.Get-Maximum-in-Generated-Array/1646. Get Maximum in Generated Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func getMaximumGenerated(n int) int { 4 | if n == 0 { 5 | return 0 6 | } 7 | nums, max := make([]int, n+1), 0 8 | nums[0], nums[1] = 0, 1 9 | for i := 0; i <= n; i++ { 10 | if nums[i] > max { 11 | max = nums[i] 12 | } 13 | if 2*i >= 2 && 2*i <= n { 14 | nums[2*i] = nums[i] 15 | } 16 | if 2*i+1 >= 2 && 2*i+1 <= n { 17 | nums[2*i+1] = nums[i] + nums[i+1] 18 | } 19 | } 20 | return max 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent/1662. Check If Two String Arrays are Equivalent.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func arrayStringsAreEqual(word1 []string, word2 []string) bool { 4 | str1, str2 := "", "" 5 | for i := 0; i < len(word1); i++ { 6 | str1 += word1[i] 7 | } 8 | for i := 0; i < len(word2); i++ { 9 | str2 += word2[i] 10 | } 11 | return str1 == str2 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/1668.Maximum-Repeating-Substring/1668. Maximum Repeating Substring.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func maxRepeating(sequence string, word string) int { 8 | for i := len(sequence) / len(word); i >= 0; i-- { 9 | tmp := "" 10 | for j := 0; j < i; j++ { 11 | tmp += word 12 | } 13 | if strings.Contains(sequence, tmp) { 14 | return i 15 | } 16 | } 17 | return 0 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1672.Richest-Customer-Wealth/1672. Richest Customer Wealth.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maximumWealth(accounts [][]int) int { 4 | res := 0 5 | for _, banks := range accounts { 6 | sAmount := 0 7 | for _, amount := range banks { 8 | sAmount += amount 9 | } 10 | if sAmount > res { 11 | res = sAmount 12 | } 13 | } 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /leetcode/1673.Find-the-Most-Competitive-Subsequence/1673. Find the Most Competitive Subsequence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 单调栈 4 | func mostCompetitive(nums []int, k int) []int { 5 | stack := make([]int, 0, len(nums)) 6 | for i := 0; i < len(nums); i++ { 7 | for len(stack)+len(nums)-i > k && len(stack) > 0 && nums[i] < stack[len(stack)-1] { 8 | stack = stack[:len(stack)-1] 9 | } 10 | stack = append(stack, nums[i]) 11 | } 12 | return stack[:k] 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1678.Goal-Parser-Interpretation/1678. Goal Parser Interpretation.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func interpret(command string) string { 4 | if command == "" { 5 | return "" 6 | } 7 | res := "" 8 | for i := 0; i < len(command); i++ { 9 | if command[i] == 'G' { 10 | res += "G" 11 | } else { 12 | if command[i] == '(' && command[i+1] == 'a' { 13 | res += "al" 14 | i += 3 15 | } else { 16 | res += "o" 17 | i++ 18 | } 19 | } 20 | } 21 | return res 22 | } 23 | -------------------------------------------------------------------------------- /leetcode/1688.Count-of-Matches-in-Tournament/1688. Count of Matches in Tournament.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | // 解法一 4 | func numberOfMatches(n int) int { 5 | return n - 1 6 | } 7 | 8 | // 解法二 模拟 9 | func numberOfMatches1(n int) int { 10 | sum := 0 11 | for n != 1 { 12 | if n&1 == 0 { 13 | sum += n / 2 14 | n = n / 2 15 | } else { 16 | sum += (n - 1) / 2 17 | n = (n-1)/2 + 1 18 | } 19 | } 20 | return sum 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minPartitions(n string) int { 4 | res := 0 5 | for i := 0; i < len(n); i++ { 6 | if int(n[i]-'0') > res { 7 | res = int(n[i] - '0') 8 | } 9 | } 10 | return res 11 | } 12 | -------------------------------------------------------------------------------- /leetcode/1700.Number-of-Students-Unable-to-Eat-Lunch/1700. Number of Students Unable to Eat Lunch.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countStudents(students []int, sandwiches []int) int { 4 | tmp, n, i := [2]int{}, len(students), 0 5 | for _, v := range students { 6 | tmp[v]++ 7 | } 8 | for i < n && tmp[sandwiches[i]] > 0 { 9 | tmp[sandwiches[i]]-- 10 | i++ 11 | } 12 | return n - i 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1704.Determine-if-String-Halves-Are-Alike/1704. Determine if String Halves Are Alike.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func halvesAreAlike(s string) bool { 4 | return numVowels(s[len(s)/2:]) == numVowels(s[:len(s)/2]) 5 | } 6 | 7 | func numVowels(x string) int { 8 | res := 0 9 | for _, c := range x { 10 | switch c { 11 | case 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U': 12 | res++ 13 | } 14 | } 15 | return res 16 | } 17 | -------------------------------------------------------------------------------- /leetcode/1716.Calculate-Money-in-Leetcode-Bank/1716. Calculate Money in Leetcode Bank.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func totalMoney(n int) int { 4 | res := 0 5 | for tmp, count := 1, 7; n > 0; tmp, count = tmp+1, 7 { 6 | for m := tmp; n > 0 && count > 0; m++ { 7 | res += m 8 | n-- 9 | count-- 10 | } 11 | } 12 | return res 13 | } 14 | -------------------------------------------------------------------------------- /leetcode/1720.Decode-XORed-Array/1720. Decode XORed Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func decode(encoded []int, first int) []int { 4 | arr := make([]int, len(encoded)+1) 5 | arr[0] = first 6 | for i, val := range encoded { 7 | arr[i+1] = arr[i] ^ val 8 | } 9 | return arr 10 | } 11 | -------------------------------------------------------------------------------- /leetcode/1732.Find-the-Highest-Altitude/1732. Find the Highest Altitude.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func largestAltitude(gain []int) int { 4 | max, height := 0, 0 5 | for _, g := range gain { 6 | height += g 7 | if height > max { 8 | max = height 9 | } 10 | } 11 | return max 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/1734.Decode-XORed-Permutation/1734. Decode XORed Permutation.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func decode(encoded []int) []int { 4 | n, total, odd := len(encoded), 0, 0 5 | for i := 1; i <= n+1; i++ { 6 | total ^= i 7 | } 8 | for i := 1; i < n; i += 2 { 9 | odd ^= encoded[i] 10 | } 11 | perm := make([]int, n+1) 12 | perm[0] = total ^ odd 13 | for i, v := range encoded { 14 | perm[i+1] = perm[i] ^ v 15 | } 16 | return perm 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1742.Maximum-Number-of-Balls-in-a-Box/1742. Maximum Number of Balls in a Box.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countBalls(lowLimit int, highLimit int) int { 4 | buckets, maxBall := [46]int{}, 0 5 | for i := lowLimit; i <= highLimit; i++ { 6 | t := 0 7 | for j := i; j > 0; { 8 | t += j % 10 9 | j = j / 10 10 | } 11 | buckets[t]++ 12 | if buckets[t] > maxBall { 13 | maxBall = buckets[t] 14 | } 15 | } 16 | return maxBall 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1748.Sum-of-Unique-Elements/1748. Sum of Unique Elements.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func sumOfUnique(nums []int) int { 4 | freq, res := make(map[int]int), 0 5 | for _, v := range nums { 6 | if _, ok := freq[v]; !ok { 7 | freq[v] = 0 8 | } 9 | freq[v]++ 10 | } 11 | for k, v := range freq { 12 | if v == 1 { 13 | res += k 14 | } 15 | } 16 | return res 17 | } 18 | -------------------------------------------------------------------------------- /leetcode/1752.Check-if-Array-Is-Sorted-and-Rotated/1752. Check if Array Is Sorted and Rotated.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func check(nums []int) bool { 4 | count := 0 5 | for i := 0; i < len(nums)-1; i++ { 6 | if nums[i] > nums[i+1] { 7 | count++ 8 | if count > 1 || nums[0] < nums[len(nums)-1] { 9 | return false 10 | } 11 | } 12 | } 13 | return true 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/1758.Minimum-Changes-To-Make-Alternating-Binary-String/1758. Minimum Changes To Make Alternating Binary String.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func minOperations(s string) int { 4 | res := 0 5 | for i := 0; i < len(s); i++ { 6 | if int(s[i]-'0') != i%2 { 7 | res++ 8 | } 9 | } 10 | return min(res, len(s)-res) 11 | } 12 | 13 | func min(a, b int) int { 14 | if a > b { 15 | return b 16 | } 17 | return a 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1791.Find-Center-of-Star-Graph/1791.Find Center of Star Graph.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func findCenter(edges [][]int) int { 4 | if edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1] { 5 | return edges[0][0] 6 | } 7 | return edges[0][1] 8 | } 9 | -------------------------------------------------------------------------------- /leetcode/1816.Truncate-Sentence/1816.Truncate Sentence.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func truncateSentence(s string, k int) string { 4 | end := 0 5 | for i := range s { 6 | if k > 0 && s[i] == ' ' { 7 | k-- 8 | } 9 | if k == 0 { 10 | end = i 11 | break 12 | } 13 | } 14 | if end == 0 { 15 | return s 16 | } 17 | return s[:end] 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/1877.Minimize-Maximum-Pair-Sum-in-Array/1877. Minimize Maximum Pair Sum in Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func minPairSum(nums []int) int { 6 | sort.Ints(nums) 7 | n, res := len(nums), 0 8 | for i, val := range nums[:n/2] { 9 | res = max(res, val+nums[n-1-i]) 10 | } 11 | return res 12 | } 13 | 14 | func max(a, b int) int { 15 | if a > b { 16 | return a 17 | } 18 | return b 19 | } 20 | -------------------------------------------------------------------------------- /leetcode/1984.Minimum-Difference-Between-Highest-and-Lowest-of-K-Scores/1984.Minimum Difference Between Highest and Lowest of K Scores.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func minimumDifference(nums []int, k int) int { 6 | sort.Ints(nums) 7 | minDiff := 100000 + 1 8 | for i := 0; i < len(nums); i++ { 9 | if i+k-1 >= len(nums) { 10 | break 11 | } 12 | diff := nums[i+k-1] - nums[i] 13 | if diff < minDiff { 14 | minDiff = diff 15 | } 16 | } 17 | return minDiff 18 | } 19 | -------------------------------------------------------------------------------- /leetcode/2022.Convert-1D-Array-Into-2D-Array/2022. Convert 1D Array Into 2D Array.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func construct2DArray(original []int, m int, n int) [][]int { 4 | if m*n != len(original) { 5 | return [][]int{} 6 | } 7 | res := make([][]int, m) 8 | for i := 0; i < m; i++ { 9 | res[i] = original[n*i : n*(i+1)] 10 | } 11 | return res 12 | } 13 | -------------------------------------------------------------------------------- /leetcode/2037.Minimum-Number-of-Moves-to-Seat-Everyone/2037.Minimum Number of Moves to Seat Everyone.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func minMovesToSeat(seats []int, students []int) int { 6 | sort.Ints(seats) 7 | sort.Ints(students) 8 | n := len(students) 9 | moves := 0 10 | for i := 0; i < n; i++ { 11 | moves += abs(seats[i], students[i]) 12 | } 13 | return moves 14 | } 15 | 16 | func abs(a, b int) int { 17 | if a > b { 18 | return a - b 19 | } 20 | return b - a 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/2169.Count-Operations-to-Obtain-Zero/2169. Count Operations to Obtain Zero.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countOperations(num1 int, num2 int) int { 4 | res := 0 5 | for num1 != 0 && num2 != 0 { 6 | if num1 >= num2 { 7 | num1 -= num2 8 | } else { 9 | num2 -= num1 10 | } 11 | res++ 12 | } 13 | return res 14 | } 15 | -------------------------------------------------------------------------------- /leetcode/2171.Removing-Minimum-Number-of-Magic-Beans/2171. Removing Minimum Number of Magic Beans.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | import "sort" 4 | 5 | func minimumRemoval(beans []int) int64 { 6 | sort.Ints(beans) 7 | sum, mx := 0, 0 8 | for i, v := range beans { 9 | sum += v 10 | mx = max(mx, (len(beans)-i)*v) 11 | } 12 | return int64(sum - mx) 13 | } 14 | 15 | func max(a, b int) int { 16 | if b > a { 17 | return b 18 | } 19 | return a 20 | } 21 | -------------------------------------------------------------------------------- /leetcode/2180.Count-Integers-With-Even-Digit-Sum/2180. Count Integers With Even Digit Sum.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func countEven(num int) int { 4 | count := 0 5 | for i := 1; i <= num; i++ { 6 | if addSum(i)%2 == 0 { 7 | count++ 8 | } 9 | } 10 | return count 11 | } 12 | 13 | func addSum(num int) int { 14 | sum := 0 15 | tmp := num 16 | for tmp != 0 { 17 | sum += tmp % 10 18 | tmp = tmp / 10 19 | } 20 | return sum 21 | } 22 | -------------------------------------------------------------------------------- /leetcode/9990085.Maximal-Rectangle/85. Maximal Rectangle.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func maximalRectangle(matrix [][]byte) int { 4 | return 0 5 | } 6 | -------------------------------------------------------------------------------- /leetcode/9990316.Remove-Duplicate-Letters/316. Remove Duplicate Letters.go: -------------------------------------------------------------------------------- 1 | package leetcode 2 | 3 | func removeDuplicateLetters(s string) string { 4 | return "" 5 | } 6 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/logo.png -------------------------------------------------------------------------------- /structures/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/halfrost/LeetCode-Go/structures 2 | 3 | go 1.19 4 | 5 | require github.com/stretchr/testify v1.8.0 6 | 7 | require ( 8 | github.com/davecgh/go-spew v1.1.1 // indirect 9 | github.com/pmezard/go-difflib v1.0.0 // indirect 10 | gopkg.in/yaml.v3 v3.0.1 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /template/BIT_test.go: -------------------------------------------------------------------------------- 1 | package template 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func Test_BIT(t *testing.T) { 9 | nums, bit := []int{1, 2, 3, 4, 5, 6, 7, 8}, BinaryIndexedTree{} 10 | bit.Init(8) 11 | fmt.Printf("nums = %v bit = %v\n", nums, bit.tree) // [0 1 3 3 10 5 11 7 36] 12 | } 13 | -------------------------------------------------------------------------------- /template/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/halfrost/LeetCode-Go/template 2 | 3 | go 1.19 4 | 5 | require github.com/stretchr/testify v1.8.0 6 | 7 | require ( 8 | github.com/davecgh/go-spew v1.1.1 // indirect 9 | github.com/pmezard/go-difflib v1.0.0 // indirect 10 | gopkg.in/yaml.v3 v3.0.1 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /topic/Backtracking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Backtracking.png -------------------------------------------------------------------------------- /topic/Binary_Indexed_Tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Binary_Indexed_Tree.png -------------------------------------------------------------------------------- /topic/Bit_Manipulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Bit_Manipulation.png -------------------------------------------------------------------------------- /topic/Linked_List.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Linked_List.png -------------------------------------------------------------------------------- /topic/Segment_Tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Segment_Tree.png -------------------------------------------------------------------------------- /topic/Sliding_Window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Sliding_Window.png -------------------------------------------------------------------------------- /topic/Sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Sort.png -------------------------------------------------------------------------------- /topic/Stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Stack.png -------------------------------------------------------------------------------- /topic/Two_pointers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Two_pointers.png -------------------------------------------------------------------------------- /topic/Union_Find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/topic/Union_Find.png -------------------------------------------------------------------------------- /website/archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0001~0099/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0100~0199/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0200~0299/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0300~0399/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0400~0499/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0500~0599/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0600~0699/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0700~0799/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0800~0899/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/0900~0999/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1000~1099/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1100~1199/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1200~1299/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1300~1399/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1400~1499/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1500~1599/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1600~1699/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1700~1799/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1800~1899/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/content/ChapterFour/1900~1999/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/content/ChapterFour/2000~2099/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/content/ChapterFour/2100~2199/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/content/ChapterFour/2200~2299/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.6cd8553a6854f4812343f0f0c8baca31271e686434f381fbe3c7226f66639176.css","MediaType":"text/css","Data":{"Integrity":"sha256-bNhVOmhU9IEjQ/DwyLrKMSceaGQ084H748cib2ZjkXY="}} -------------------------------------------------------------------------------- /website/resources/_gen/assets/scss/leetcode/book.scss_50fc8c04e12a2f59027287995557ceff.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.fcdb1f07040371dc4d234f40698d15b7fb50f2dc9982bcd0898d9806ff4e07f8.css","MediaType":"text/css","Data":{"Integrity":"sha256-/NsfBwQDcdxNI09AaY0Vt/tQ8tyZgrzQiY2YBv9OB/g="}} -------------------------------------------------------------------------------- /website/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/static/logo.png -------------------------------------------------------------------------------- /website/static/wechat-qr-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/static/wechat-qr-code.png -------------------------------------------------------------------------------- /website/themes/book/.gitignore: -------------------------------------------------------------------------------- 1 | public/ 2 | exampleSite/public/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /website/themes/book/archetypes/docs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ .Name | humanize | title }}" 3 | weight: 1 4 | # bookFlatSection: false 5 | # bookToc: true 6 | # bookHidden: false 7 | # bookCollapseSection: false 8 | # bookComments: true 9 | --- 10 | -------------------------------------------------------------------------------- /website/themes/book/archetypes/posts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | --- 5 | -------------------------------------------------------------------------------- /website/themes/book/assets/_print.scss: -------------------------------------------------------------------------------- 1 | @media print { 2 | .book-menu, 3 | .book-footer, 4 | .book-toc { 5 | display: none; 6 | } 7 | 8 | .book-header, 9 | .book-header aside { 10 | display: block; 11 | } 12 | 13 | main { 14 | // Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=939897 15 | display: block !important; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /website/themes/book/assets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* You can override SASS variables here. */ 2 | 3 | // @import "plugins/dark"; 4 | -------------------------------------------------------------------------------- /website/themes/book/assets/book.scss: -------------------------------------------------------------------------------- 1 | @import "defaults"; 2 | @import "variables"; 3 | @import "themes/{{ default "light" .Site.Params.BookTheme }}"; 4 | 5 | @import "normalize"; 6 | @import "utils"; 7 | @import "main"; 8 | @import "fonts"; 9 | @import "print"; 10 | 11 | @import "markdown"; 12 | @import "shortcodes"; 13 | 14 | // Custom defined styles 15 | @import "custom"; 16 | -------------------------------------------------------------------------------- /website/themes/book/assets/menu-reset.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var menu = document.querySelector("aside.book-menu nav"); 3 | addEventListener("beforeunload", function(event) { 4 | localStorage.setItem("menu.scrollTop", menu.scrollTop); 5 | }); 6 | menu.scrollTop = localStorage.getItem("menu.scrollTop"); 7 | })(); 8 | -------------------------------------------------------------------------------- /website/themes/book/assets/mermaid.json: -------------------------------------------------------------------------------- 1 | { 2 | "flowchart": { 3 | "useMaxWidth":true 4 | }, 5 | "theme": "default" 6 | } 7 | -------------------------------------------------------------------------------- /website/themes/book/assets/plugins/_dark.scss: -------------------------------------------------------------------------------- 1 | $gray-100: rgba(255, 255, 255, 0.1); 2 | $gray-200: rgba(255, 255, 255, 0.2); 3 | 4 | $body-background: #343a40; 5 | $body-font-color: #e9ecef; 6 | 7 | $color-link: #84b2ff; 8 | $color-visited-link: #b88dff; 9 | 10 | $icon-filter: brightness(0) invert(1); 11 | -------------------------------------------------------------------------------- /website/themes/book/assets/plugins/_scrollbars.scss: -------------------------------------------------------------------------------- 1 | @import "defaults"; 2 | @import "variables"; 3 | 4 | // Webkit 5 | ::-webkit-scrollbar { 6 | width: $padding-8; 7 | } 8 | 9 | ::-webkit-scrollbar-thumb { 10 | background: transparent; 11 | border-radius: $padding-8; 12 | } 13 | 14 | :hover::-webkit-scrollbar-thumb { 15 | background: var(--gray-500); 16 | } 17 | 18 | // MS 19 | body { 20 | -ms-overflow-style: -ms-autohiding-scrollbar; 21 | } 22 | 23 | // Future 24 | .book-menu nav { 25 | scrollbar-color: transparent var(--gray-500); 26 | } 27 | -------------------------------------------------------------------------------- /website/themes/book/assets/sw-register.js: -------------------------------------------------------------------------------- 1 | {{- $swJS := resources.Get "sw.js" | resources.ExecuteAsTemplate "sw.js" . -}} 2 | if (navigator.serviceWorker) { 3 | navigator.serviceWorker.register( 4 | "{{ $swJS.RelPermalink }}", 5 | { scope: "{{ "/" | relURL }}" } 6 | ); 7 | } 8 | -------------------------------------------------------------------------------- /website/themes/book/assets/themes/_auto.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-light; 3 | } 4 | 5 | @media (prefers-color-scheme: dark) { 6 | :root { 7 | @include theme-dark; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /website/themes/book/assets/themes/_dark.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-dark; 3 | } 4 | -------------------------------------------------------------------------------- /website/themes/book/assets/themes/_light.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-light; 3 | } 4 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/assets/_custom.scss: -------------------------------------------------------------------------------- 1 | /* You can add custom styles here. */ 2 | 3 | // @import "plugins/numbered"; 4 | // @import "plugins/scrollbars"; 5 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/assets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* You can override SASS variables here. */ 2 | 3 | // @import "plugins/dark"; 4 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/example/collapsed/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/shortcodes/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookFlatSection: true 3 | --- 4 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/shortcodes/buttons.md: -------------------------------------------------------------------------------- 1 | # Buttons 2 | 3 | Buttons are styled links that can lead to local page or external link. 4 | 5 | ## Example 6 | 7 | ```tpl 8 | {{}}Get Home{{}} 9 | {{}}Contribute{{}} 10 | ``` 11 | 12 | {{< button relref="/" >}}Get Home{{< /button >}} 13 | {{< button href="https://github.com/alex-shpak/hugo-book" >}}Contribute{{< /button >}} 14 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/shortcodes/section/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | --- 4 | 5 | # Section 6 | 7 | Section renders pages in section as definition list, using title and description. 8 | 9 | ## Example 10 | 11 | ```tpl 12 | {{}} 13 | ``` 14 | 15 | {{
}} 16 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/shortcodes/section/page1.md: -------------------------------------------------------------------------------- 1 | # Page 1 2 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/docs/shortcodes/section/page2.md: -------------------------------------------------------------------------------- 1 | # Page 2 2 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/content/posts/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: 3 | after: 4 | name: blog 5 | weight: 5 6 | title: Blog 7 | --- 8 | -------------------------------------------------------------------------------- /website/themes/book/exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.5ac6c2989f0943405962be6800b442aef429ef26ade26545ecf0617a21d1197a.css","MediaType":"text/css","Data":{"Integrity":"sha256-WsbCmJ8JQ0BZYr5oALRCrvQp7yat4mVF7PBheiHRGXo="}} -------------------------------------------------------------------------------- /website/themes/book/i18n/bn.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: অনুসন্ধান 3 | 4 | - id: Edit this page 5 | translation: এই পৃষ্ঠাটি সম্পাদনা করুন 6 | 7 | - id: Last modified by 8 | translation: সর্বশেষ সম্পাদনা করেছেন 9 | 10 | - id: Expand 11 | translation: বিস্তৃত করা 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/cn.yaml: -------------------------------------------------------------------------------- 1 | # This should be removed in future, 'cn' is moved to `zh' 2 | - id: Search 3 | translation: 搜索 4 | 5 | - id: Edit this page 6 | translation: 编辑本页 7 | 8 | - id: Last modified by 9 | translation: 最后修改者 10 | 11 | - id: Expand 12 | translation: 展开 13 | 14 | - id: bookSearchConfig 15 | translation: | 16 | { 17 | encode: false, 18 | tokenize: function(str) { 19 | return str.replace(/[\x00-\x7F]/g, '').split(''); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/themes/book/i18n/cs.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Vyhledávat 3 | 4 | - id: Edit this page 5 | translation: Upravit tuto stránku 6 | 7 | - id: Last modified by 8 | translation: Autor poslední změny 9 | 10 | - id: Expand 11 | translation: Rozbalit 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/de.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Suche 3 | 4 | - id: Edit this page 5 | translation: Seite bearbeiten 6 | 7 | - id: Last modified by 8 | translation: Zuletzt geändert von 9 | 10 | - id: Expand 11 | translation: Erweitern 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/en.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Search 3 | 4 | - id: Edit this page 5 | translation: Edit this page 6 | 7 | - id: Last modified by 8 | translation: Last modified by 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/es.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Buscar 3 | 4 | - id: Edit this page 5 | translation: Editar esta página 6 | 7 | - id: Last modified by 8 | translation: Última modificación por 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/fr.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Rechercher 3 | 4 | - id: Edit this page 5 | translation: Modifier cette page 6 | 7 | - id: Last modified by 8 | translation: Dernière modification par 9 | 10 | - id: Expand 11 | translation: Développer 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/ja.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 検索 3 | 4 | - id: Edit this page 5 | translation: このページを編集する 6 | 7 | - id: Last modified by 8 | translation: 最終更新者 9 | 10 | - id: Expand 11 | translation: 展開 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/themes/book/i18n/jp.yaml: -------------------------------------------------------------------------------- 1 | # This should be removed in future, 'jp' is moved to `ja' 2 | - id: Search 3 | translation: 検索 4 | 5 | - id: Edit this page 6 | translation: このページを編集する 7 | 8 | - id: Last modified by 9 | translation: 最終更新者 10 | 11 | - id: Expand 12 | translation: 展開 13 | 14 | - id: bookSearchConfig 15 | translation: | 16 | { 17 | encode: false, 18 | tokenize: function(str) { 19 | return str.replace(/[\x00-\x7F]/g, '').split(''); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/themes/book/i18n/ko.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Search 3 | 4 | - id: Edit this page 5 | translation: Edit this page 6 | 7 | - id: Last modified by 8 | translation: Last modified by 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/themes/book/i18n/nb.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Søk 3 | 4 | - id: Edit this page 5 | translation: Rediger denne siden 6 | 7 | - id: Last modified by 8 | translation: Sist endret av 9 | 10 | - id: Expand 11 | translation: Utvid 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/pt.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Buscar 3 | 4 | - id: Edit this page 5 | translation: Editar página 6 | 7 | - id: Last modified by 8 | translation: Última modificação por 9 | 10 | - id: Expand 11 | translation: Expandir 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/ru.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Поиск 3 | 4 | - id: Edit this page 5 | translation: Редактировать эту страницу 6 | 7 | - id: Last modified by 8 | translation: Последнее изменение от 9 | 10 | - id: Expand 11 | translation: Развернуть 12 | 13 | - id: bookSearchConfig 14 | translation: '{ split: /[^a-zа-яё0-9\w]/gi }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/sv.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Sök 3 | 4 | - id: Edit this page 5 | translation: Redigera denna sida 6 | 7 | - id: Last modified by 8 | translation: Senast modifierad av 9 | 10 | - id: Expand 11 | translation: Expandera 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/tr.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Arama 3 | 4 | - id: Edit this page 5 | translation: Bu sayfayı düzenle 6 | 7 | - id: Last modified by 8 | translation: Son düzenleyen 9 | 10 | - id: Expand 11 | translation: Genişlet 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/uk.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Пошук 3 | 4 | - id: Edit this page 5 | translation: Редагувати цю сторінку 6 | 7 | - id: Last modified by 8 | translation: Остання зміна від 9 | 10 | - id: Expand 11 | translation: Розгорнути 12 | 13 | - id: bookSearchConfig 14 | translation: '{ split: /[^a-zа-яё0-9\w]/gi }' 15 | -------------------------------------------------------------------------------- /website/themes/book/i18n/zh-TW.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 搜索 3 | 4 | - id: Edit this page 5 | translation: 編輯頁面 6 | 7 | - id: Last modified by 8 | translation: 最後修改者 9 | 10 | - id: Expand 11 | translation: 展開 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/themes/book/i18n/zh.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 搜索 3 | 4 | - id: Edit this page 5 | translation: 编辑本页 6 | 7 | - id: Last modified by 8 | translation: 最后修改者 9 | 10 | - id: Expand 11 | translation: 展开 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /website/themes/book/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/images/screenshot.png -------------------------------------------------------------------------------- /website/themes/book/images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/images/tn.png -------------------------------------------------------------------------------- /website/themes/book/layouts/_default/_markup/render-heading.html: -------------------------------------------------------------------------------- 1 | 2 | {{ .Text | safeHTML }} 3 | # 4 | 5 | -------------------------------------------------------------------------------- /website/themes/book/layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "dummy" }}{{ end }} 2 | -------------------------------------------------------------------------------- /website/themes/book/layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "dummy" }}{{ end }} 2 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/comments.html: -------------------------------------------------------------------------------- 1 | 2 | {{ template "_internal/disqus.html" . }} 3 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/date.html: -------------------------------------------------------------------------------- 1 | 5 | {{- $format := default "January 2, 2006" .Format -}} 6 | {{- return (.Date.Format $format) -}} 7 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/header.html: -------------------------------------------------------------------------------- 1 |
2 | 5 | 6 | {{ partial "docs/title" . }} 7 | 8 | 13 |
14 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/content-after.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/content-after.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/content-before.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/content-before.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/footer.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/footer.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/menu-after.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/menu-after.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/menu-before.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/menu-before.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/toc-after.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/toc-after.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/inject/toc-before.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/layouts/partials/docs/inject/toc-before.html -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/menu-bundle.html: -------------------------------------------------------------------------------- 1 | {{ with .Site.GetPage .Site.Params.BookMenuBundle }} 2 | {{- $href := printf "href=\"%s\"" $.RelPermalink -}} 3 | {{- replace .Content $href (print $href "class=active") | safeHTML -}} 4 | {{ end }} 5 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/title.html: -------------------------------------------------------------------------------- 1 | 5 | {{ $title := "" }} 6 | 7 | {{ if .Title }} 8 | {{ $title = .Title }} 9 | {{ else if and .IsSection .File }} 10 | {{ $title = path.Base .File.Dir | humanize | title }} 11 | {{ else if and .IsPage .File }} 12 | {{ $title = .File.BaseFileName | humanize | title }} 13 | {{ end }} 14 | 15 | {{ return $title }} 16 | -------------------------------------------------------------------------------- /website/themes/book/layouts/partials/docs/toc.html: -------------------------------------------------------------------------------- 1 | {{ partial "docs/inject/toc-before" . }} 2 | {{ .TableOfContents }} 3 | {{ partial "docs/inject/toc-after" . }} 4 | -------------------------------------------------------------------------------- /website/themes/book/layouts/posts/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 |

4 | {{ partial "docs/title.html" . }} 5 |

6 | {{ partial "docs/post-meta" . }} 7 | {{- .Content -}} 8 |
9 | {{ end }} 10 | 11 | {{ define "toc" }} 12 | {{ partial "docs/toc" . }} 13 | {{ end }} 14 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/button.html: -------------------------------------------------------------------------------- 1 | {{ $ref := "" }} 2 | {{ $target := "" }} 3 | {{ with .Get "href" }} 4 | {{ $ref = . }} 5 | {{ $target = "_blank" }} 6 | {{ end }} 7 | {{ with .Get "relref" }} 8 | {{ $ref = relref $ . }} 9 | {{ end }} 10 | 11 | {{ $.Inner | markdownify }} 12 | 13 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/columns.html: -------------------------------------------------------------------------------- 1 |
2 | {{ range split .Inner "<--->" }} 3 |
4 | {{ . | markdownify }} 5 |
6 | {{ end }} 7 |
8 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/details.html: -------------------------------------------------------------------------------- 1 |
2 | {{ cond .IsNamedParams (.Get "title") (.Get 0) }} 3 |
4 | {{ .Inner | markdownify }} 5 |
6 |
7 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/expand.html: -------------------------------------------------------------------------------- 1 | {{ warnf "Expand shortcode is deprecated. Use 'details' instead." }} 2 |
3 | 13 |
14 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/hint.html: -------------------------------------------------------------------------------- 1 |
2 | {{ .Inner | markdownify }} 3 |
4 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/mermaid.html: -------------------------------------------------------------------------------- 1 | {{ if not (.Page.Scratch.Get "mermaid") }} 2 | 3 | 4 | {{ with resources.Get "mermaid.json" }} 5 | 6 | {{ end }} 7 | {{ .Page.Scratch.Set "mermaid" true }} 8 | {{ end }} 9 | 10 |

11 | {{- .Inner -}} 12 |

13 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/section.html: -------------------------------------------------------------------------------- 1 |
2 | {{ range .Page.Pages }} 3 |
4 | {{ partial "docs/title" . }} 5 |
6 |
7 | {{ default .Summary .Description }} 8 |
9 | {{ end }} 10 |
11 | -------------------------------------------------------------------------------- /website/themes/book/layouts/shortcodes/tab.html: -------------------------------------------------------------------------------- 1 | {{ if .Parent }} 2 | {{ $name := .Get 0 }} 3 | {{ $group := printf "tabs-%s" (.Parent.Get 0) }} 4 | 5 | {{ if not (.Parent.Scratch.Get $group) }} 6 | {{ .Parent.Scratch.Set $group slice }} 7 | {{ end }} 8 | 9 | {{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }} 10 | {{ else }} 11 | {{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }} 12 | {{ end}} 13 | -------------------------------------------------------------------------------- /website/themes/book/layouts/taxonomy/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 |

{{ .Title | title }}

4 | {{ $taxonomies := index .Site.Taxonomies .Page.Type }} 5 | {{ range $taxonomies }} 6 |
{{ .Page.Title }} {{ .Count }}
7 | {{ end }} 8 |
9 | {{ end }} 10 | 11 | {{ define "toc" }} 12 | {{ partial "docs/taxonomy" . }} 13 | {{ end }} 14 | -------------------------------------------------------------------------------- /website/themes/book/static/LeetCode_Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/LeetCode_Icon.png -------------------------------------------------------------------------------- /website/themes/book/static/LeetCode_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/LeetCode_logo.png -------------------------------------------------------------------------------- /website/themes/book/static/LeetCode_logo2048.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/LeetCode_logo2048.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-1024x1024.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-512x512.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /website/themes/book/static/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /website/themes/book/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/favicon.png -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-mono-v6-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-mono-v6-latin-regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-mono-v6-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-mono-v6-latin-regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-300italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-300italic.woff -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-300italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-300italic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-700.woff -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-700.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/fonts/roboto-v19-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/fonts/roboto-v19-latin-regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfrost/LeetCode-Go/d78a9e0927a302038992428433d2eb450efd93a2/website/themes/book/static/katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /website/themes/book/static/svg/calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/themes/book/static/svg/edit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/themes/book/static/svg/menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/themes/book/static/svg/toc.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/themes/book/static/svg/translate.svg: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------