比如第 1 题 two-sum
go run main.go -a=1
比如第 100 题 same-tree
go run main.go -a=100
个人建议刷完前50题后,完全刷一个系列的,比如我最近在刷 Tree,因为 Tree 是最简单的~
刷题过程中要整理好自己的解题模板
切记!!!!不要相信 自己解题可以提高智商 这种鬼话, 5分钟没思路直接看答案,千万别浪费时间
然后 模板流 一把嗖,目标是 所有算法全是手!速!题!
分类 : 1 级目录
题名 : 2 级目录
算法 : 3-N 级目录
执行 go run main.go 自动生成 readme.md
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0001 | Two Sum | 47.6% | Easy | Go | hash table |
| 0004 | Median of Two Sorted Arrays | 36.8% | Hard | Go | binary search |
| 0011 | Container With Most Water | 61.3% | Medium | Go | two pointer |
| 0015 | 3Sum | 25.5% | Medium | Go | two pointer |
| 0016 | 3Sum Closest | 43.0% | Medium | Go | two pointer |
| 0018 | 4Sum | 37.2% | Medium | Go | two pointer |
| 0026 | Remove Duplicates from Sorted Array | 48.6% | Easy | Go | two pointer |
| 0027 | Remove Element | 57.4% | Easy | Go | two pointer |
| 0030 | Substring with Concatenation of All Words | 29.2% | Hard | Go | two pointer |
| 0033 | Search in Rotated Sorted Array | 36.4% | Medium | Go | binary search |
| 0034 | Find First and Last Position of Element in Sorted Array | 39.0% | Medium | Go | binary search |
| 0035 | Search Insert Position | 45.2% | Easy | Go | binary search |
| 0036 | Valid Sudoku | 58.4% | Medium | Go | dfs |
| 0037 | Sudoku Solver | 59.5% | Hard | Go | dfs |
| 0041 | First Missing Positive | 37.6% | Hard | Go | bit map |
| 0042 | Trapping Rain Water | 48.6% | Hard | Go | two pointer |
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0002 | Add Two Numbers | 36.6% | Medium | Go | |
| 0019 | Remove Nth Node From End of List | 37.5% | Medium | Go | two pointer |
| 0021 | Merge Two Sorted Lists | 59.7% | Easy | Go | |
| 0023 | Merge k Sorted Lists | 48.8% | Hard | Go | |
| 0024 | Swap Nodes in Pairs | 64.3% | Medium | Go | |
| 0025 | Reverse Nodes in k-Group | 56.2% | Hard | Go |
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0007 | Reverse Integer | 33.6% | Easy | Go | |
| 0008 | String to Integer (atoi) | 19.1% | Medium | Go | |
| 0009 | Palindrome Number | 57.1% | Easy | Go | |
| 0012 | Integer to Roman | 62.6% | Medium | Go | |
| 0013 | Roman to Integer | 60.7% | Easy | Go | |
| 0029 | Divide Two Integers | 19.3% | Medium | Go | |
| 0031 | Next Permutation | 32.8% | Medium | Go | |
| 0292 | Nim Game | 69.7% | Easy | Go | |
| 0319 | Bulb Switcher | 44.6% | Medium | Go |
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0020 | Valid Parentheses | 40.9% | Easy | Go | |
| 0032 | Longest Valid Parentheses | 29.7% | Hard | Go |
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0003 | Longest Substring Without Repeating Characters | 32.9% | Medium | Go | |
| 0005 | Longest Palindromic Substring | 28.5% | Medium | Go | |
| 0006 | ZigZag Conversion | 46.7% | Medium | Go | |
| 0010 | Regular Expression Matching | 26.0% | Hard | Go | |
| 0014 | Longest Common Prefix | 36.2% | Easy | Go | |
| 0017 | Letter Combinations of a Phone Number | 52.5% | Medium | Go | |
| 0028 | Implement strStr() | 39.5% | Easy | Go | |
| 0038 | Count and Say | 54.4% | Easy | Go | |
| 0043 | Multiply Strings | 41.6% | Medium | Go | |
| 0415 | Add Strings | 49.5% | Easy | Go |
| # | Title | Acceptance | Difficulty | Solution | Algorithm |
|---|---|---|---|---|---|
| 0022 | Generate Parentheses | 73.3% | Medium | Go | dfs.catalan |
| Go | dfs.recursive | ||||
| 0039 | Combination Sum | 68.4% | Medium | Go | dfs.recursive |
| 0040 | Combination Sum II | 60.1% | Medium | Go | dfs.recursive |
| 0094 | Binary Tree Inorder Traversal | 70.2% | Medium | Go | dfs.inorder.recursive |
| Go | dfs.inorder.stack | ||||
| Go | dfs.morris.break | ||||
| Go | dfs.morris.keep | ||||
| 0095 | Unique Binary Search Trees II | 61.4% | Medium | Go | dfs.catalan |
| 0096 | Unique Binary Search Trees | 64.8% | Medium | Go | catalan |
| Go | dp | ||||
| 0098 | Validate Binary Search Tree | 28.9% | Medium | Go | bfs |
| Go | dfs.inorder.recursive | ||||
| Go | dfs.inorder.stack | ||||
| Go | dfs.preorder.recursive | ||||
| Go | dfs.preorder.stack | ||||
| 0099 | Recover Binary Search Tree | 54.9% | Hard | Go | dfs.inorder.recursive |
| Go | dfs.inorder.stack | ||||
| Go | dfs.morris | ||||
| 0100 | Same Tree | 56.5% | Easy | Go | dfs.recursive |
| 0101 | Symmetric Tree | 50.0% | Easy | Go | dfs.recursive |
| 0102 | Binary Tree Level Order Traversal | 60.9% | Medium | Go | bfs.queue |
| Go | dfs.recursive | ||||
| 0103 | Binary Tree Zigzag Level Order Traversal | 53.6% | Medium | Go | bfs.queue |
| Go | dfs.recursive | ||||
| 0104 | Maximum Depth of Binary Tree | 72.2% | Easy | Go | dfs |
| 0105 | Construct Binary Tree from Preorder and Inorder Traversal | 64.1% | Medium | Go | |
| 0106 | Construct Binary Tree from Inorder and Postorder Traversal | 66.9% | Medium | Go | |
| 0107 | Binary Tree Level Order Traversal II | 64.3% | Easy | Go | bfs.queue |
| Go | dfs.recursive | ||||
| 0108 | Convert Sorted Array to Binary Search Tree | 69.1% | Easy | Go | dfs.recursive |
| 0109 | Convert Sorted List to Binary Search Tree | 70.3% | Medium | Go | array |
| Go | inorder | ||||
| Go | recursive | ||||
| 0110 | Balanced Binary Tree | 50.2% | Easy | Go | postorder |
| Go | top | ||||
| 0111 | Minimum Depth of Binary Tree | 41.5% | Easy | Go | bfs |
| Go | dfs | ||||
| 0112 | Path Sum | 49.0% | Easy | Go | dfs |
| 0113 | Path Sum II | 58.7% | Medium | Go | dfs |
| 0114 | Flatten Binary Tree to Linked List | 67.5% | Medium | Go | preorder.morris |
| 0116 | Populating Next Right Pointers in Each Node | 53.9% | Medium | Go | bfs |
| Go | dfs |