代码重构 【Github Actions】

This commit is contained in:
github-actions[bot] 2021-07-29 02:33:38 +00:00
parent 5a5325b0c8
commit a8b66cd5ae
38 changed files with 110 additions and 159 deletions

View File

@ -80,3 +80,4 @@ func dailyTemperatures(temperatures []int) []int {
} }
return arr return arr
} }
```

View File

@ -116,4 +116,5 @@ func (m *MinStack) GetMin() int {
return m.minStk[len(m.minStk) - 1] return m.minStk[len(m.minStk) - 1]
} }
``` ```
### ###

View File

@ -261,7 +261,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -304,4 +303,3 @@ func max(a, b int) int {
return b return b
} }
``` ```

View File

@ -203,7 +203,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -218,4 +217,3 @@ func twoSum(nums []int, target int) []int {
return []int{} return []int{}
} }
``` ```

View File

@ -243,4 +243,3 @@ func containsNearbyDuplicate(nums []int, k int) bool {
return false return false
} }
``` ```

View File

@ -183,7 +183,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -203,4 +202,3 @@ func removeElement(nums []int, val int) int {
return i return i
} }
``` ```

View File

@ -274,7 +274,6 @@ public:
}; };
``` ```
Go Code: Go Code:
```go ```go
@ -297,4 +296,3 @@ func firstMissingPositive(nums []int) int {
return length + 1 return length + 1
} }
``` ```

View File

@ -22,7 +22,7 @@
下面我们通过一个视频模拟代码执行步骤大家一下就能搞懂了 下面我们通过一个视频模拟代码执行步骤大家一下就能搞懂了
![leetcode485最长连续1的个数](https://cdn.jsdelivr.net/gh/tan45du/test1@master/20210122/leetcode485最长连续1的个数.7avzcthkit80.gif) ![leetcode485最长连续1的个数](https://cdn.jsdelivr.net/gh/tan45du/test1@master/20210122/leetcode485最长连续1的个数.7avzcthkit80.gif)
下面我们直接看代码吧 下面我们直接看代码吧
@ -231,4 +231,3 @@ func max(a, b int) int {
return b return b
} }
``` ```

View File

@ -181,7 +181,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -218,4 +217,3 @@ func spiralOrder(matrix [][]int) []int {
return res return res
} }
``` ```

View File

@ -236,4 +236,3 @@ func subarraySum(nums []int, k int) int {
return cnt return cnt
} }
``` ```

View File

@ -361,7 +361,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -405,4 +404,3 @@ func generateMatrix(n int) [][]int {
return res return res
} }
``` ```

View File

@ -138,4 +138,3 @@ func plusOne(digits []int) []int {
return digits return digits
} }
``` ```

View File

@ -173,8 +173,6 @@ func sortColors(nums []int) {
} }
``` ```
另外我们看这段代码有什么问题呢那就是我们即使完全符合时仍会交换元素这样会大大降低我们的效率 另外我们看这段代码有什么问题呢那就是我们即使完全符合时仍会交换元素这样会大大降低我们的效率
例如[0,0,0,1,1,1,2,2,2] 例如[0,0,0,1,1,1,2,2,2]
@ -336,4 +334,3 @@ func sortColors(nums []int) {
} }
} }
``` ```

View File

@ -120,7 +120,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -150,4 +149,3 @@ func min(a, b int) int {
return b return b
} }
``` ```

View File

@ -163,7 +163,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -210,4 +209,3 @@ func threeSum(nums []int) [][]int {
return res return res
} }
``` ```

View File

@ -96,7 +96,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -150,6 +149,3 @@ func fourSum(nums []int, target int) [][]int {
return res return res
} }
``` ```

View File

@ -228,7 +228,6 @@ class Solution:
return nums[len(nums) - 1] return nums[len(nums) - 1]
``` ```
Go Code: Go Code:
```go ```go
@ -248,8 +247,6 @@ func singleNumber(nums []int) int {
} }
``` ```
### HashSet ### HashSet
#### 解析 #### 解析

View File

@ -530,4 +530,3 @@ func reverse(node *ListNode) *ListNode {
return pre return pre
} }
``` ```

View File

@ -125,7 +125,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -142,4 +141,3 @@ func hasCycle(head *ListNode) bool {
return false return false
} }
``` ```

View File

@ -298,7 +298,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -322,4 +321,3 @@ func detectCycle(head *ListNode) *ListNode {
return nil return nil
} }
``` ```

View File

@ -258,7 +258,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -289,4 +288,3 @@ func insertionSortList(head *ListNode) *ListNode {
return root.Next return root.Next
} }
``` ```

View File

@ -195,7 +195,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -222,4 +221,3 @@ func deleteDuplicates(head *ListNode) *ListNode {
return root.Next return root.Next
} }
``` ```

View File

@ -188,7 +188,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -214,4 +213,3 @@ func partition(head *ListNode, x int) *ListNode {
return headSmall.Next return headSmall.Next
} }
``` ```

View File

@ -264,7 +264,6 @@ class Solution {
} }
``` ```
GoCode: GoCode:
```go ```go
@ -307,4 +306,3 @@ func reverse(head *ListNode) *ListNode {
return pre return pre
} }
``` ```

View File

@ -147,7 +147,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -173,4 +172,3 @@ func mergeTwoLists(l1 *ListNode, l2 *ListNode) *ListNode {
return root.Next return root.Next
} }
``` ```

View File

@ -164,7 +164,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -182,4 +181,3 @@ func getKthFromEnd(head *ListNode, k int) *ListNode {
return after return after
} }
``` ```

View File

@ -136,7 +136,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -150,4 +149,3 @@ func middleNode(head *ListNode) *ListNode {
return slow return slow
} }
``` ```

View File

@ -268,7 +268,6 @@ class Solution {
} }
``` ```
Go Code: Go Code:
```go ```go
@ -305,4 +304,3 @@ func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
return root.Next return root.Next
} }
``` ```