代码重构 【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
}
```

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -231,4 +231,3 @@ func max(a, b int) int {
return b
}
```

View File

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

View File

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

View File

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

View File

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

View File

@@ -173,8 +173,6 @@ func sortColors(nums []int) {
}
```
另外我们看这段代码有什么问题呢那就是我们即使完全符合时仍会交换元素这样会大大降低我们的效率
例如[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
@@ -150,4 +149,3 @@ func min(a, b int) int {
return b
}
```

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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