Skip to content

Latest commit

 

History

History
executable file
·
205 lines (194 loc) · 15.4 KB

README.md

File metadata and controls

executable file
·
205 lines (194 loc) · 15.4 KB

LeetCode习题的Golang解答

LeetCode LeetCode Ranking Build Status codecov

答题进度:34%

仅含免费题

Category Easy Medium Hard Total
Algorithms 53 / 145 84 / 250 32 / 93 169 / 488
Draft 0 / 1 0 / 3 0 / 0 0 / 4
Total 53 / 146 84 / 253 32 / 93 169 / 492

参考解答

题号 题目 难度 总体通过率 收藏
1 Two Sum 35%
2 Add Two Numbers ☆ ☆ 27%
3 Longest Substring Without Repeating Characters ☆ ☆ 24%
4 Median of Two Sorted Arrays ☆ ☆ ☆ 21%
5 Longest Palindromic Substring ☆ ☆ 25%
6 ZigZag Conversion ☆ ☆ 26%
7 Reverse Integer 24%
8 String to Integer (atoi) ☆ ☆ 13%
9 Palindrome Number 35%
10 Regular Expression Matching ☆ ☆ ☆ 24%
11 Container With Most Water ☆ ☆ 36%
12 Integer to Roman ☆ ☆ 45%
13 Roman to Integer 46%
14 Longest Common Prefix 31%
15 3Sum ☆ ☆ 21%
16 3Sum Closest ☆ ☆ 31%
17 Letter Combinations of a Phone Number ☆ ☆ 34%
18 4Sum ☆ ☆ 26%
19 Remove Nth Node From End of List ☆ ☆ 33%
20 Valid Parentheses 33%
21 Merge Two Sorted Lists 39%
22 Generate Parentheses ☆ ☆ 45%
23 Merge k Sorted Lists ☆ ☆ ☆ 27%
24 Swap Nodes in Pairs ☆ ☆ 38%
25 Reverse Nodes in k-Group ☆ ☆ ☆ 30%
26 Remove Duplicates from Sorted Array 35%
27 Remove Element 39%
28 Implement strStr() 28%
29 Divide Two Integers ☆ ☆ 15%
30 Substring with Concatenation of All Words ☆ ☆ ☆ 22%
31 Next Permutation ☆ ☆ 28%
32 Longest Valid Parentheses ☆ ☆ ☆ 23%
33 Search in Rotated Sorted Array ☆ ☆ 32%
34 Search for a Range ☆ ☆ 31%
35 Search Insert Position 39%
36 Valid Sudoku ☆ ☆ 35%
37 Sudoku Solver ☆ ☆ ☆ 30%
38 Count and Say 34%
39 Combination Sum ☆ ☆ 39%
40 Combination Sum II ☆ ☆ 34%
41 First Missing Positive ☆ ☆ ☆ 25%
42 Trapping Rain Water ☆ ☆ ☆ 36%
43 Multiply Strings ☆ ☆ 27%
44 Wildcard Matching ☆ ☆ ☆ 20%
45 Jump Game II ☆ ☆ ☆ 26%
46 Permutations ☆ ☆ 44%
47 Permutations II ☆ ☆ 33%
48 Rotate Image ☆ ☆ 38%
49 Group Anagrams ☆ ☆ 35%
50 Pow(x, n) ☆ ☆ 26%
51 N-Queens ☆ ☆ ☆ 31%
52 N-Queens II ☆ ☆ ☆ 45%
53 Maximum Subarray 39%
54 Spiral Matrix ☆ ☆ 26%
55 Jump Game ☆ ☆ 29%
56 Merge Intervals ☆ ☆ 30%
57 Insert Interval ☆ ☆ ☆ 27%
58 Length of Last Word 31%
59 Spiral Matrix II ☆ ☆ 39%
60 Permutation Sequence ☆ ☆ 28%
61 Rotate List ☆ ☆ 24%
62 Unique Paths ☆ ☆ 41%
63 Unique Paths II ☆ ☆ 31%
64 Minimum Path Sum ☆ ☆ 38%
65 Valid Number ☆ ☆ ☆ 12%
66 Plus One 38%
67 Add Binary 32%
68 Text Justification ☆ ☆ ☆ 19%
69 Sqrt(x) 27%
70 Climbing Stairs 40%
71 Simplify Path ☆ ☆ 25%
72 Edit Distance ☆ ☆ ☆ 31%
73 Set Matrix Zeroes ☆ ☆ 35%
74 Search a 2D Matrix ☆ ☆ 34%
75 Sort Colors ☆ ☆ 38%
76 Minimum Window Substring ☆ ☆ ☆ 25%
77 Combinations ☆ ☆ 39%
78 Subsets ☆ ☆ 41%
79 Word Search ☆ ☆ 26%
80 Remove Duplicates from Sorted Array II ☆ ☆ 36%
81 Search in Rotated Sorted Array II ☆ ☆ 32%
82 Remove Duplicates from Sorted List II ☆ ☆ 29%
83 Remove Duplicates from Sorted List 39%
84 Largest Rectangle in Histogram ☆ ☆ ☆ 26%
85 Maximal Rectangle ☆ ☆ ☆ 28%
86 Partition List ☆ ☆ 32%
87 Scramble String ☆ ☆ ☆ 29%
88 Merge Sorted Array 32%
89 Gray Code ☆ ☆ 41%
90 Subsets II ☆ ☆ 36%
91 Decode Ways ☆ ☆ 19%
92 Reverse Linked List II ☆ ☆ 30%
93 Restore IP Addresses ☆ ☆ 27%
94 Binary Tree Inorder Traversal ☆ ☆ 46%
95 Unique Binary Search Trees II ☆ ☆ 31%
96 Unique Binary Search Trees ☆ ☆ 41%
97 Interleaving String ☆ ☆ ☆ 24%
98 Validate Binary Search Tree ☆ ☆ 23%
99 Recover Binary Search Tree ☆ ☆ ☆ 29%
100 Same Tree 46%
101 Symmetric Tree 38%
102 Binary Tree Level Order Traversal ☆ ☆ 40%
103 Binary Tree Zigzag Level Order Traversal ☆ ☆ 34%
104 Maximum Depth of Binary Tree 52%
105 Construct Binary Tree from Preorder and Inorder Traversal ☆ ☆ 32%
106 Construct Binary Tree from Inorder and Postorder Traversal ☆ ☆ 32%
107 Binary Tree Level Order Traversal II 40%
108 Convert Sorted Array to Binary Search Tree 42%
109 Convert Sorted List to Binary Search Tree ☆ ☆ 34%
110 Balanced Binary Tree 37%
111 Minimum Depth of Binary Tree 33%
112 Path Sum 34%
113 Path Sum II ☆ ☆ 33%
114 Flatten Binary Tree to Linked List ☆ ☆ 35%
115 Distinct Subsequences ☆ ☆ ☆ 31%
118 Pascal's Triangle 38%
119 Pascal's Triangle II 37%
120 Triangle ☆ ☆ 33%
121 Best Time to Buy and Sell Stock 41%
122 Best Time to Buy and Sell Stock II 47%
123 Best Time to Buy and Sell Stock III ☆ ☆ ☆ 29%
124 Binary Tree Maximum Path Sum ☆ ☆ ☆ 26%
125 Valid Palindrome 26%
126 Word Ladder II ☆ ☆ ☆ 14%
127 Word Ladder ☆ ☆ 19%
152 Maximum Product Subarray ☆ ☆ 25%
153 Find Minimum in Rotated Sorted Array ☆ ☆ 40%
154 Find Minimum in Rotated Sorted Array II ☆ ☆ ☆ 37%
162 Find Peak Element ☆ ☆ 37%
167 Two Sum II - Input array is sorted 47%
169 Majority Element 46%
188 Best Time to Buy and Sell Stock IV ☆ ☆ ☆ 24%
189 Rotate Array 24%
206 Reverse Linked List 45%
209 Minimum Size Subarray Sum ☆ ☆ 30%
216 Combination Sum III ☆ ☆ 45%
217 Contains Duplicate 45%
219 Contains Duplicate II 32%
228 Summary Ranges ☆ ☆ 30%
229 Majority Element II ☆ ☆ 28%
238 Product of Array Except Self ☆ ☆ 49%
268 Missing Number 44%
283 Move Zeroes 50%
287 Find the Duplicate Number ☆ ☆ 43%
289 Game of Life ☆ ☆ 37%
380 Insert Delete GetRandom O(1) ☆ ☆ 39%
381 Insert Delete GetRandom O(1) - Duplicates allowed ☆ ☆ ☆ 28%
414 Third Maximum Number 27%
437 Path Sum III 39%
442 Find All Duplicates in an Array ☆ ☆ 55%
448 Find All Numbers Disappeared in an Array 51%
485 Max Consecutive Ones 53%
495 Teemo Attacking ☆ ☆ 51%
526 Beautiful Arrangement ☆ ☆ 54%
532 K-diff Pairs in an Array 28%
560 Subarray Sum Equals K ☆ ☆ 40%
561 Array Partition I 67%
565 Array Nesting ☆ ☆ 49%
566 Reshape the Matrix 58%
581 Shortest Unsorted Continuous Subarray 29%
605 Can Place Flowers 30%
611 Valid Triangle Number ☆ ☆ 41%
621 Task Scheduler ☆ ☆ 42%
628 Maximum Product of Three Numbers 45%
639 Decode Ways II ☆ ☆ ☆ 23%
643 Maximum Average Subarray I 37%
661 Image Smoother 46%
667 Beautiful Arrangement II ☆ ☆ 51%

以下题目,暂时不能使用 Golang 解答

helper

helper会帮助处理大部分琐碎的工作。

notes

notes记录了我答题过程中,对知识点的总结。

kit

kit中添加了LeetCode常用的数据结构和处理函数:

  1. *ListNode添加了与[]int相互转换的函数,方便添加单元测试。使用方式可以参考21. Merge Two Sorted Lists
  2. *TreeNode添加了与[]int相互转换的函数,方便添加单元测试。