Skip to content

Commit 0646ca2

Browse files
authored
feat: use the built-in min max functions in Go 1.21.0+ (doocs#1908)
1 parent f8ed7c6 commit 0646ca2

File tree

1,937 files changed

+8
-16855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,937 files changed

+8
-16855
lines changed

lcci/01.05.One Away/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,6 @@ func oneEditAway(first string, second string) bool {
180180
}
181181
return dp[m][n] == 1
182182
}
183-
184-
func min(x, y, z int) int {
185-
if x < y {
186-
if x < z {
187-
return x
188-
}
189-
return z
190-
}
191-
if y < z {
192-
return y
193-
}
194-
return z
195-
}
196183
```
197184

198185
### **TypeScript**

lcci/01.05.One Away/README_EN.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,6 @@ func oneEditAway(first string, second string) bool {
164164
}
165165
return dp[m][n] == 1
166166
}
167-
168-
func min(x, y, z int) int {
169-
if x < y {
170-
if x < z {
171-
return x
172-
}
173-
return z
174-
}
175-
if y < z {
176-
return y
177-
}
178-
return z
179-
}
180167
```
181168

182169
### **TypeScript**

lcci/01.05.One Away/Solution.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,4 @@ func oneEditAway(first string, second string) bool {
2626
}
2727
}
2828
return dp[m][n] == 1
29-
}
30-
31-
func min(x, y, z int) int {
32-
if x < y {
33-
if x < z {
34-
return x
35-
}
36-
return z
37-
}
38-
if y < z {
39-
return y
40-
}
41-
return z
4229
}

lcci/03.02.Min Stack/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,6 @@ func (this *MinStack) GetMin() int {
217217
return this.stk2[len(this.stk2)-1]
218218
}
219219

220-
func min(a, b int) int {
221-
if a < b {
222-
return a
223-
}
224-
return b
225-
}
226-
227220
/**
228221
* Your MinStack object will be instantiated and called as such:
229222
* obj := Constructor();

lcci/03.02.Min Stack/README_EN.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,6 @@ func (this *MinStack) GetMin() int {
176176
return this.stk2[len(this.stk2)-1]
177177
}
178178

179-
func min(a, b int) int {
180-
if a < b {
181-
return a
182-
}
183-
return b
184-
}
185-
186179
/**
187180
* Your MinStack object will be instantiated and called as such:
188181
* obj := Constructor();

lcci/03.02.Min Stack/Solution.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ func (this *MinStack) GetMin() int {
2626
return this.stk2[len(this.stk2)-1]
2727
}
2828

29-
func min(a, b int) int {
30-
if a < b {
31-
return a
32-
}
33-
return b
34-
}
35-
3629
/**
3730
* Your MinStack object will be instantiated and called as such:
3831
* obj := Constructor();

lcci/04.04.Check Balance/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,6 @@ func isBalanced(root *TreeNode) bool {
163163
return dfs(root) >= 0
164164
}
165165
166-
func max(a, b int) int {
167-
if a > b {
168-
return a
169-
}
170-
return b
171-
}
172-
173166
func abs(x int) int {
174167
if x < 0 {
175168
return -x

lcci/04.04.Check Balance/README_EN.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ func isBalanced(root *TreeNode) bool {
187187
return dfs(root) >= 0
188188
}
189189
190-
func max(a, b int) int {
191-
if a > b {
192-
return a
193-
}
194-
return b
195-
}
196-
197190
func abs(x int) int {
198191
if x < 0 {
199192
return -x

lcci/04.04.Check Balance/Solution.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ func isBalanced(root *TreeNode) bool {
2121
return dfs(root) >= 0
2222
}
2323

24-
func max(a, b int) int {
25-
if a > b {
26-
return a
27-
}
28-
return b
29-
}
30-
3124
func abs(x int) int {
3225
if x < 0 {
3326
return -x

lcci/05.03.Reverse Bits/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,6 @@ func reverseBits(num int) (ans int) {
103103
}
104104
return
105105
}
106-
107-
func max(a, b int) int {
108-
if a > b {
109-
return a
110-
}
111-
return b
112-
}
113106
```
114107

115108
### **...**

0 commit comments

Comments
 (0)