diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..93139647
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,13 @@
+{
+ "go.formatTool": "gofmt",
+ "go.formatFlags": [
+ "-s"
+ ],
+ "[go]": {
+ "editor.insertSpaces": false,
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.organizeImports": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 8a959dfa..6dbed5a4 100644
--- a/README.md
+++ b/README.md
@@ -8,20 +8,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
支持 Progressive Web Apps 和 Dark Mode 的题解电子书《LeetCode Cookbook》 Online Reading
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..b0f76088
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module LeetCode-Go
+
+go 1.14
diff --git a/leetcode/0001.Two-Sum/1. Two Sum_test.go b/leetcode/0001.Two-Sum/1. Two Sum_test.go
index f3cbedbe..e6378be0 100644
--- a/leetcode/0001.Two-Sum/1. Two Sum_test.go
+++ b/leetcode/0001.Two-Sum/1. Two Sum_test.go
@@ -26,32 +26,30 @@ type ans1 struct {
func Test_Problem1(t *testing.T) {
qs := []question1{
-
- question1{
+ {
para1{[]int{3, 2, 4}, 6},
ans1{[]int{1, 2}},
},
- question1{
+ {
para1{[]int{3, 2, 4}, 5},
ans1{[]int{0, 1}},
},
- question1{
+ {
para1{[]int{0, 8, 7, 3, 3, 4, 2}, 11},
ans1{[]int{1, 3}},
},
- question1{
+ {
para1{[]int{0, 1}, 1},
ans1{[]int{0, 1}},
},
- question1{
+ {
para1{[]int{0, 3}, 5},
ans1{[]int{}},
},
-
// 如需多个测试,可以复制上方元素。
}
diff --git a/leetcode/0002.Add-Two-Numbers/2. Add Two Numbers_test.go b/leetcode/0002.Add-Two-Numbers/2. Add Two Numbers_test.go
index 2660d4dd..d615065b 100644
--- a/leetcode/0002.Add-Two-Numbers/2. Add Two Numbers_test.go
+++ b/leetcode/0002.Add-Two-Numbers/2. Add Two Numbers_test.go
@@ -29,42 +29,42 @@ func Test_Problem2(t *testing.T) {
qs := []question2{
- question2{
+ {
para2{[]int{}, []int{}},
ans2{[]int{}},
},
- question2{
+ {
para2{[]int{1}, []int{1}},
ans2{[]int{2}},
},
- question2{
+ {
para2{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans2{[]int{2, 4, 6, 8}},
},
- question2{
+ {
para2{[]int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5}},
ans2{[]int{2, 4, 6, 8, 0, 1}},
},
- question2{
+ {
para2{[]int{1}, []int{9, 9, 9, 9, 9}},
ans2{[]int{0, 0, 0, 0, 0, 1}},
},
- question2{
+ {
para2{[]int{9, 9, 9, 9, 9}, []int{1}},
ans2{[]int{0, 0, 0, 0, 0, 1}},
},
- question2{
+ {
para2{[]int{2, 4, 3}, []int{5, 6, 4}},
ans2{[]int{7, 0, 8}},
},
- question2{
+ {
para2{[]int{1, 8, 3}, []int{7, 1}},
ans2{[]int{8, 9, 3}},
},
diff --git a/leetcode/0003.Longest-Substring-Without-Repeating-Characters/3. Longest Substring Without Repeating Characters_test.go b/leetcode/0003.Longest-Substring-Without-Repeating-Characters/3. Longest Substring Without Repeating Characters_test.go
index 03be5391..5dc9bcd2 100644
--- a/leetcode/0003.Longest-Substring-Without-Repeating-Characters/3. Longest Substring Without Repeating Characters_test.go
+++ b/leetcode/0003.Longest-Substring-Without-Repeating-Characters/3. Longest Substring Without Repeating Characters_test.go
@@ -26,22 +26,22 @@ func Test_Problem3(t *testing.T) {
qs := []question3{
- question3{
+ {
para3{"abcabcbb"},
ans3{3},
},
- question3{
+ {
para3{"bbbbb"},
ans3{1},
},
- question3{
+ {
para3{"pwwkew"},
ans3{3},
},
- question3{
+ {
para3{""},
ans3{0},
},
diff --git a/leetcode/0004.Median-of-Two-Sorted-Arrays/4. Median of Two Sorted Arrays_test.go b/leetcode/0004.Median-of-Two-Sorted-Arrays/4. Median of Two Sorted Arrays_test.go
index c24c8e53..14d21d0e 100644
--- a/leetcode/0004.Median-of-Two-Sorted-Arrays/4. Median of Two Sorted Arrays_test.go
+++ b/leetcode/0004.Median-of-Two-Sorted-Arrays/4. Median of Two Sorted Arrays_test.go
@@ -27,12 +27,12 @@ func Test_Problem4(t *testing.T) {
qs := []question4{
- question4{
+ {
para4{[]int{1, 3}, []int{2}},
ans4{2.0},
},
- question4{
+ {
para4{[]int{1, 2}, []int{3, 4}},
ans4{2.5},
},
diff --git a/leetcode/0007.Reverse-Integer/7. Reverse Integer_test.go b/leetcode/0007.Reverse-Integer/7. Reverse Integer_test.go
index 8fb8e594..4154fb9e 100644
--- a/leetcode/0007.Reverse-Integer/7. Reverse Integer_test.go
+++ b/leetcode/0007.Reverse-Integer/7. Reverse Integer_test.go
@@ -26,22 +26,22 @@ func Test_Problem7(t *testing.T) {
qs := []question7{
- question7{
+ {
para7{321},
ans7{123},
},
- question7{
+ {
para7{-123},
ans7{-321},
},
- question7{
+ {
para7{120},
ans7{21},
},
- question7{
+ {
para7{1534236469},
ans7{0},
},
diff --git a/leetcode/0009.Palindrome-Number/9. Palindrome Number_test.go b/leetcode/0009.Palindrome-Number/9. Palindrome Number_test.go
index a9eaff03..57f46540 100644
--- a/leetcode/0009.Palindrome-Number/9. Palindrome Number_test.go
+++ b/leetcode/0009.Palindrome-Number/9. Palindrome Number_test.go
@@ -26,37 +26,37 @@ func Test_Problem9(t *testing.T) {
qs := []question9{
- question9{
+ {
para9{121},
ans9{true},
},
- question9{
+ {
para9{-121},
ans9{false},
},
- question9{
+ {
para9{10},
ans9{false},
},
- question9{
+ {
para9{321},
ans9{false},
},
- question9{
+ {
para9{-123},
ans9{false},
},
- question9{
+ {
para9{120},
ans9{false},
},
- question9{
+ {
para9{1534236469},
ans9{false},
},
diff --git a/leetcode/0011.Container-With-Most-Water/11. Container With Most Water_test.go b/leetcode/0011.Container-With-Most-Water/11. Container With Most Water_test.go
index f48a305e..b9185a28 100644
--- a/leetcode/0011.Container-With-Most-Water/11. Container With Most Water_test.go
+++ b/leetcode/0011.Container-With-Most-Water/11. Container With Most Water_test.go
@@ -26,12 +26,12 @@ func Test_Problem11(t *testing.T) {
qs := []question11{
- question11{
+ {
para11{[]int{1, 8, 6, 2, 5, 4, 8, 3, 7}},
ans11{49},
},
- question11{
+ {
para11{[]int{1, 1}},
ans11{1},
},
diff --git a/leetcode/0013.Roman-to-Integer/13. Roman to Integer_test.go b/leetcode/0013.Roman-to-Integer/13. Roman to Integer_test.go
index 539e6645..b611319e 100644
--- a/leetcode/0013.Roman-to-Integer/13. Roman to Integer_test.go
+++ b/leetcode/0013.Roman-to-Integer/13. Roman to Integer_test.go
@@ -26,32 +26,32 @@ func Test_Problem13(t *testing.T) {
qs := []question13{
- question13{
+ {
para13{"III"},
ans13{3},
},
- question13{
+ {
para13{"IV"},
ans13{4},
},
- question13{
+ {
para13{"IX"},
ans13{9},
},
- question13{
+ {
para13{"LVIII"},
ans13{58},
},
- question13{
+ {
para13{"MCMXCIV"},
ans13{1994},
},
- question13{
+ {
para13{"MCMXICIVI"},
ans13{2014},
},
diff --git a/leetcode/0015.3Sum/15. 3Sum_test.go b/leetcode/0015.3Sum/15. 3Sum_test.go
index d4413411..e48b7d14 100644
--- a/leetcode/0015.3Sum/15. 3Sum_test.go
+++ b/leetcode/0015.3Sum/15. 3Sum_test.go
@@ -26,26 +26,26 @@ func Test_Problem15(t *testing.T) {
qs := []question15{
- question15{
+ {
para15{[]int{0, 0, 0}},
- ans15{[][]int{[]int{0, 0, 0}}},
+ ans15{[][]int{{0, 0, 0}}},
},
- question15{
+ {
para15{[]int{-1, 0, 1, 2, -1, -4}},
- ans15{[][]int{[]int{-1, 0, 1}, []int{-1, -1, 2}}},
+ ans15{[][]int{{-1, 0, 1}, {-1, -1, 2}}},
},
- question15{
+ {
para15{[]int{-4, -2, -2, -2, 0, 1, 2, 2, 2, 3, 3, 4, 4, 6, 6}},
- ans15{[][]int{[]int{-4, -2, 6}, []int{-4, 0, 4}, []int{-4, 1, 3}, []int{-4, 2, 2}, []int{-2, -2, 4}, []int{-2, 0, 2}}},
+ ans15{[][]int{{-4, -2, 6}, {-4, 0, 4}, {-4, 1, 3}, {-4, 2, 2}, {-2, -2, 4}, {-2, 0, 2}}},
},
- question15{
+ {
para15{[]int{5, -7, 3, -3, 5, -10, 4, 8, -3, -8, -3, -3, -1, -8, 6, 4, -4, 7, 2, -5, -2, -7, -3, 7, 2, 4, -6, 5}},
- ans15{[][]int{[]int{-10, 2, 8}, []int{-10, 3, 7}, []int{-10, 4, 6}, []int{-10, 5, 5}, []int{-8, 2, 6}, []int{-8, 3, 5}, []int{-8, 4, 4}, []int{-7, -1, 8},
- []int{-7, 2, 5}, []int{-7, 3, 4}, []int{-6, -2, 8}, []int{-6, -1, 7}, []int{-6, 2, 4}, []int{-5, -3, 8}, []int{-5, -2, 7}, []int{-5, -1, 6}, []int{-5, 2, 3},
- []int{-4, -3, 7}, []int{-4, -2, 6}, []int{-4, -1, 5}, []int{-4, 2, 2}, []int{-3, -3, 6}, []int{-3, -2, 5}, []int{-3, -1, 4}, []int{-2, -1, 3}}},
+ ans15{[][]int{{-10, 2, 8}, {-10, 3, 7}, {-10, 4, 6}, {-10, 5, 5}, {-8, 2, 6}, {-8, 3, 5}, {-8, 4, 4}, {-7, -1, 8},
+ {-7, 2, 5}, {-7, 3, 4}, {-6, -2, 8}, {-6, -1, 7}, {-6, 2, 4}, {-5, -3, 8}, {-5, -2, 7}, {-5, -1, 6}, {-5, 2, 3},
+ {-4, -3, 7}, {-4, -2, 6}, {-4, -1, 5}, {-4, 2, 2}, {-3, -3, 6}, {-3, -2, 5}, {-3, -1, 4}, {-2, -1, 3}}},
},
}
diff --git a/leetcode/0016.3Sum-Closest/16. 3Sum Closest_test.go b/leetcode/0016.3Sum-Closest/16. 3Sum Closest_test.go
index 0db2570e..0fd4d392 100644
--- a/leetcode/0016.3Sum-Closest/16. 3Sum Closest_test.go
+++ b/leetcode/0016.3Sum-Closest/16. 3Sum Closest_test.go
@@ -27,27 +27,27 @@ func Test_Problem16(t *testing.T) {
qs := []question16{
- question16{
+ {
para16{[]int{-1, 0, 1, 1, 55}, 3},
ans16{2},
},
- question16{
+ {
para16{[]int{0, 0, 0}, 1},
ans16{0},
},
- question16{
+ {
para16{[]int{-1, 2, 1, -4}, 1},
ans16{2},
},
- question16{
+ {
para16{[]int{1, 1, -1}, 0},
ans16{1},
},
- question16{
+ {
para16{[]int{-1, 2, 1, -4}, 1},
ans16{2},
},
diff --git a/leetcode/0017.Letter-Combinations-of-a-Phone-Number/17. Letter Combinations of a Phone Number_test.go b/leetcode/0017.Letter-Combinations-of-a-Phone-Number/17. Letter Combinations of a Phone Number_test.go
index fffeeb44..f384ff46 100644
--- a/leetcode/0017.Letter-Combinations-of-a-Phone-Number/17. Letter Combinations of a Phone Number_test.go
+++ b/leetcode/0017.Letter-Combinations-of-a-Phone-Number/17. Letter Combinations of a Phone Number_test.go
@@ -26,7 +26,7 @@ func Test_Problem17(t *testing.T) {
qs := []question17{
- question17{
+ {
para17{"23"},
ans17{[]string{"ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"}},
},
diff --git a/leetcode/0018.4Sum/18. 4Sum_test.go b/leetcode/0018.4Sum/18. 4Sum_test.go
index a1de6e8d..bc08f2fb 100644
--- a/leetcode/0018.4Sum/18. 4Sum_test.go
+++ b/leetcode/0018.4Sum/18. 4Sum_test.go
@@ -27,29 +27,29 @@ func Test_Problem18(t *testing.T) {
qs := []question18{
- question18{
+ {
para18{[]int{1, 1, 1, 1}, 4},
- ans18{[][]int{[]int{1, 1, 1, 1}}},
+ ans18{[][]int{{1, 1, 1, 1}}},
},
- question18{
+ {
para18{[]int{0, 1, 5, 0, 1, 5, 5, -4}, 11},
- ans18{[][]int{[]int{-4, 5, 5, 5}, []int{0, 1, 5, 5}}},
+ ans18{[][]int{{-4, 5, 5, 5}, {0, 1, 5, 5}}},
},
- question18{
+ {
para18{[]int{1, 0, -1, 0, -2, 2}, 0},
- ans18{[][]int{[]int{-1, 0, 0, 1}, []int{-2, -1, 1, 2}, []int{-2, 0, 0, 2}}},
+ ans18{[][]int{{-1, 0, 0, 1}, {-2, -1, 1, 2}, {-2, 0, 0, 2}}},
},
- question18{
+ {
para18{[]int{1, 0, -1, 0, -2, 2, 0, 0, 0, 0}, 0},
- ans18{[][]int{[]int{-1, 0, 0, 1}, []int{-2, -1, 1, 2}, []int{-2, 0, 0, 2}, []int{0, 0, 0, 0}}},
+ ans18{[][]int{{-1, 0, 0, 1}, {-2, -1, 1, 2}, {-2, 0, 0, 2}, {0, 0, 0, 0}}},
},
- question18{
+ {
para18{[]int{1, 0, -1, 0, -2, 2, 0, 0, 0, 0}, 1},
- ans18{[][]int{[]int{-1, 0, 0, 2}, []int{-2, 0, 1, 2}, []int{0, 0, 0, 1}}},
+ ans18{[][]int{{-1, 0, 0, 2}, {-2, 0, 1, 2}, {0, 0, 0, 1}}},
},
}
diff --git a/leetcode/0019.Remove-Nth-Node-From-End-of-List/19. Remove Nth Node From End of List_test.go b/leetcode/0019.Remove-Nth-Node-From-End-of-List/19. Remove Nth Node From End of List_test.go
index bee4e53d..e7be4810 100644
--- a/leetcode/0019.Remove-Nth-Node-From-End-of-List/19. Remove Nth Node From End of List_test.go
+++ b/leetcode/0019.Remove-Nth-Node-From-End-of-List/19. Remove Nth Node From End of List_test.go
@@ -29,26 +29,26 @@ func Test_Problem19(t *testing.T) {
qs := []question19{
- question19{
+ {
para19{[]int{1, 2, 3, 4, 5}, 1},
ans19{[]int{1, 2, 3, 4}},
},
- question19{
+ {
para19{[]int{1, 2, 3, 4, 5}, 2},
ans19{[]int{1, 2, 3, 5}},
},
- question19{
+ {
para19{[]int{1, 2, 3, 4, 5}, 3},
ans19{[]int{1, 2, 4, 5}},
},
- question19{
+ {
para19{[]int{1, 2, 3, 4, 5}, 4},
ans19{[]int{1, 3, 4, 5}},
},
- question19{
+ {
para19{[]int{1, 2, 3, 4, 5}, 5},
ans19{[]int{2, 3, 4, 5}},
},
diff --git a/leetcode/0020.Valid-Parentheses/20. Valid Parentheses_test.go b/leetcode/0020.Valid-Parentheses/20. Valid Parentheses_test.go
index 76ce3146..482e54cb 100644
--- a/leetcode/0020.Valid-Parentheses/20. Valid Parentheses_test.go
+++ b/leetcode/0020.Valid-Parentheses/20. Valid Parentheses_test.go
@@ -26,35 +26,35 @@ func Test_Problem20(t *testing.T) {
qs := []question20{
- question20{
+ {
para20{"()[]{}"},
ans20{true},
},
- question20{
+ {
para20{"(]"},
ans20{false},
},
- question20{
+ {
para20{"({[]})"},
ans20{true},
},
- question20{
+ {
para20{"(){[({[]})]}"},
ans20{true},
},
- question20{
+ {
para20{"((([[[{{{"},
ans20{false},
},
- question20{
+ {
para20{"(())]]"},
ans20{false},
},
- question20{
+ {
para20{""},
ans20{true},
},
- question20{
+ {
para20{"["},
ans20{false},
},
diff --git a/leetcode/0021.Merge-Two-Sorted-Lists/21. Merge Two Sorted Lists_test.go b/leetcode/0021.Merge-Two-Sorted-Lists/21. Merge Two Sorted Lists_test.go
index 8ca0b481..f79777c0 100644
--- a/leetcode/0021.Merge-Two-Sorted-Lists/21. Merge Two Sorted Lists_test.go
+++ b/leetcode/0021.Merge-Two-Sorted-Lists/21. Merge Two Sorted Lists_test.go
@@ -29,42 +29,42 @@ func Test_Problem21(t *testing.T) {
qs := []question21{
- question21{
+ {
para21{[]int{}, []int{}},
ans21{[]int{}},
},
- question21{
+ {
para21{[]int{1}, []int{1}},
ans21{[]int{1, 1}},
},
- question21{
+ {
para21{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans21{[]int{1, 1, 2, 2, 3, 3, 4, 4}},
},
- question21{
+ {
para21{[]int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5}},
ans21{[]int{1, 1, 2, 2, 3, 3, 4, 4, 5, 5}},
},
- question21{
+ {
para21{[]int{1}, []int{9, 9, 9, 9, 9}},
ans21{[]int{1, 9, 9, 9, 9, 9}},
},
- question21{
+ {
para21{[]int{9, 9, 9, 9, 9}, []int{1}},
ans21{[]int{1, 9, 9, 9, 9, 9}},
},
- question21{
+ {
para21{[]int{2, 3, 4}, []int{4, 5, 6}},
ans21{[]int{2, 3, 4, 4, 5, 6}},
},
- question21{
+ {
para21{[]int{1, 3, 8}, []int{1, 7}},
ans21{[]int{1, 1, 3, 7, 8}},
},
diff --git a/leetcode/0022.Generate-Parentheses/22. Generate Parentheses_test.go b/leetcode/0022.Generate-Parentheses/22. Generate Parentheses_test.go
index 5e21a3da..7f41625e 100644
--- a/leetcode/0022.Generate-Parentheses/22. Generate Parentheses_test.go
+++ b/leetcode/0022.Generate-Parentheses/22. Generate Parentheses_test.go
@@ -26,7 +26,7 @@ func Test_Problem22(t *testing.T) {
qs := []question22{
- question22{
+ {
para22{3},
ans22{[]string{
"((()))",
diff --git a/leetcode/0023.Merge-k-Sorted-Lists/23. Merge k Sorted Lists_test.go b/leetcode/0023.Merge-k-Sorted-Lists/23. Merge k Sorted Lists_test.go
index bb66cad4..30989903 100644
--- a/leetcode/0023.Merge-k-Sorted-Lists/23. Merge k Sorted Lists_test.go
+++ b/leetcode/0023.Merge-k-Sorted-Lists/23. Merge k Sorted Lists_test.go
@@ -28,63 +28,63 @@ func Test_Problem23(t *testing.T) {
qs := []question23{
- question23{
+ {
para23{[][]int{}},
ans23{[]int{}},
},
- question23{
+ {
para23{[][]int{
- []int{1},
- []int{1},
+ {1},
+ {1},
}},
ans23{[]int{1, 1}},
},
- question23{
+ {
para23{[][]int{
- []int{1, 2, 3, 4},
- []int{1, 2, 3, 4},
+ {1, 2, 3, 4},
+ {1, 2, 3, 4},
}},
ans23{[]int{1, 1, 2, 2, 3, 3, 4, 4}},
},
- question23{
+ {
para23{[][]int{
- []int{1, 2, 3, 4, 5},
- []int{1, 2, 3, 4, 5},
+ {1, 2, 3, 4, 5},
+ {1, 2, 3, 4, 5},
}},
ans23{[]int{1, 1, 2, 2, 3, 3, 4, 4, 5, 5}},
},
- question23{
+ {
para23{[][]int{
- []int{1},
- []int{9, 9, 9, 9, 9},
+ {1},
+ {9, 9, 9, 9, 9},
}},
ans23{[]int{1, 9, 9, 9, 9, 9}},
},
- question23{
+ {
para23{[][]int{
- []int{9, 9, 9, 9, 9},
- []int{1},
+ {9, 9, 9, 9, 9},
+ {1},
}},
ans23{[]int{1, 9, 9, 9, 9, 9}},
},
- question23{
+ {
para23{[][]int{
- []int{2, 3, 4},
- []int{4, 5, 6},
+ {2, 3, 4},
+ {4, 5, 6},
}},
ans23{[]int{2, 3, 4, 4, 5, 6}},
},
- question23{
+ {
para23{[][]int{
- []int{1, 3, 8},
- []int{1, 7},
+ {1, 3, 8},
+ {1, 7},
}},
ans23{[]int{1, 1, 3, 7, 8}},
},
diff --git a/leetcode/0024.Swap-Nodes-in-Pairs/24. Swap Nodes in Pairs_test.go b/leetcode/0024.Swap-Nodes-in-Pairs/24. Swap Nodes in Pairs_test.go
index 56ff303c..9997800f 100644
--- a/leetcode/0024.Swap-Nodes-in-Pairs/24. Swap Nodes in Pairs_test.go
+++ b/leetcode/0024.Swap-Nodes-in-Pairs/24. Swap Nodes in Pairs_test.go
@@ -28,22 +28,22 @@ func Test_Problem24(t *testing.T) {
qs := []question24{
- question24{
+ {
para24{[]int{}},
ans24{[]int{}},
},
- question24{
+ {
para24{[]int{1}},
ans24{[]int{1}},
},
- question24{
+ {
para24{[]int{1, 2, 3, 4}},
ans24{[]int{2, 1, 4, 3}},
},
- question24{
+ {
para24{[]int{1, 2, 3, 4, 5}},
ans24{[]int{2, 1, 4, 3, 5}},
},
diff --git a/leetcode/0025.Reverse-Nodes-in-k-Group/25. Reverse Nodes in k Group_test.go b/leetcode/0025.Reverse-Nodes-in-k-Group/25. Reverse Nodes in k Group_test.go
index 34baf936..52221c07 100644
--- a/leetcode/0025.Reverse-Nodes-in-k-Group/25. Reverse Nodes in k Group_test.go
+++ b/leetcode/0025.Reverse-Nodes-in-k-Group/25. Reverse Nodes in k Group_test.go
@@ -29,7 +29,7 @@ func Test_Problem25(t *testing.T) {
qs := []question25{
- question25{
+ {
para25{
[]int{1, 2, 3, 4, 5},
3,
@@ -37,7 +37,7 @@ func Test_Problem25(t *testing.T) {
ans25{[]int{3, 2, 1, 4, 5}},
},
- question25{
+ {
para25{
[]int{1, 2, 3, 4, 5},
1,
diff --git a/leetcode/0026.Remove-Duplicates-from-Sorted-Array/26. Remove Duplicates from Sorted Array_test.go b/leetcode/0026.Remove-Duplicates-from-Sorted-Array/26. Remove Duplicates from Sorted Array_test.go
index 10ee62e1..74cc3ca0 100644
--- a/leetcode/0026.Remove-Duplicates-from-Sorted-Array/26. Remove Duplicates from Sorted Array_test.go
+++ b/leetcode/0026.Remove-Duplicates-from-Sorted-Array/26. Remove Duplicates from Sorted Array_test.go
@@ -26,22 +26,22 @@ func Test_Problem26(t *testing.T) {
qs := []question26{
- question26{
+ {
para26{[]int{1, 1, 2}},
ans26{2},
},
- question26{
+ {
para26{[]int{0, 0, 1, 1, 1, 1, 2, 3, 4, 4}},
ans26{5},
},
- question26{
+ {
para26{[]int{0, 0, 0, 0, 0}},
ans26{1},
},
- question26{
+ {
para26{[]int{1}},
ans26{1},
},
diff --git a/leetcode/0027.Remove-Element/27. Remove Element_test.go b/leetcode/0027.Remove-Element/27. Remove Element_test.go
index fa3a1653..719bf7dc 100644
--- a/leetcode/0027.Remove-Element/27. Remove Element_test.go
+++ b/leetcode/0027.Remove-Element/27. Remove Element_test.go
@@ -27,32 +27,32 @@ func Test_Problem27(t *testing.T) {
qs := []question27{
- question27{
+ {
para27{[]int{1, 0, 1}, 1},
ans27{1},
},
- question27{
+ {
para27{[]int{0, 1, 0, 3, 0, 12}, 0},
ans27{3},
},
- question27{
+ {
para27{[]int{0, 1, 0, 3, 0, 0, 0, 0, 1, 12}, 0},
ans27{4},
},
- question27{
+ {
para27{[]int{0, 0, 0, 0, 0}, 0},
ans27{0},
},
- question27{
+ {
para27{[]int{1}, 1},
ans27{0},
},
- question27{
+ {
para27{[]int{0, 1, 2, 2, 3, 0, 4, 2}, 2},
ans27{5},
},
diff --git a/leetcode/0028.Implement-strStr/28. Implement strStr()_test.go b/leetcode/0028.Implement-strStr/28. Implement strStr()_test.go
index e0e928ff..d06f2bf7 100644
--- a/leetcode/0028.Implement-strStr/28. Implement strStr()_test.go
+++ b/leetcode/0028.Implement-strStr/28. Implement strStr()_test.go
@@ -27,32 +27,32 @@ func Test_Problem28(t *testing.T) {
qs := []question28{
- question28{
+ {
para28{"abab", "ab"},
ans28{0},
},
- question28{
+ {
para28{"hello", "ll"},
ans28{2},
},
- question28{
+ {
para28{"", "abc"},
ans28{0},
},
- question28{
+ {
para28{"abacbabc", "abc"},
ans28{5},
},
- question28{
+ {
para28{"abacbabc", "abcd"},
ans28{-1},
},
- question28{
+ {
para28{"abacbabc", ""},
ans28{0},
},
diff --git a/leetcode/0029.Divide-Two-Integers/29. Divide Two Integers_test.go b/leetcode/0029.Divide-Two-Integers/29. Divide Two Integers_test.go
index 670ee6de..9be6c89f 100644
--- a/leetcode/0029.Divide-Two-Integers/29. Divide Two Integers_test.go
+++ b/leetcode/0029.Divide-Two-Integers/29. Divide Two Integers_test.go
@@ -27,27 +27,27 @@ func Test_Problem29(t *testing.T) {
qs := []question29{
- question29{
+ {
para29{10, 3},
ans29{3},
},
- question29{
+ {
para29{7, -3},
ans29{-2},
},
- question29{
+ {
para29{-1, 1},
ans29{-1},
},
- question29{
+ {
para29{1, -1},
ans29{-1},
},
- question29{
+ {
para29{2147483647, 3},
ans29{715827882},
},
diff --git a/leetcode/0030.Substring-with-Concatenation-of-All-Words/30. Substring with Concatenation of All Words_test.go b/leetcode/0030.Substring-with-Concatenation-of-All-Words/30. Substring with Concatenation of All Words_test.go
index 7ee2c50c..c6ed5fc3 100644
--- a/leetcode/0030.Substring-with-Concatenation-of-All-Words/30. Substring with Concatenation of All Words_test.go
+++ b/leetcode/0030.Substring-with-Concatenation-of-All-Words/30. Substring with Concatenation of All Words_test.go
@@ -27,57 +27,57 @@ func Test_Problem30(t *testing.T) {
qs := []question30{
- question30{
+ {
para30{"aaaaaaaa", []string{"aa", "aa", "aa"}},
ans30{[]int{0, 1, 2}},
},
- question30{
+ {
para30{"barfoothefoobarman", []string{"foo", "bar"}},
ans30{[]int{0, 9}},
},
- question30{
+ {
para30{"wordgoodgoodgoodbestword", []string{"word", "good", "best", "word"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"goodgoodgoodgoodgood", []string{"good"}},
ans30{[]int{0, 4, 8, 12, 16}},
},
- question30{
+ {
para30{"barofoothefoolbarman", []string{"foo", "bar"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"bbarffoothefoobarman", []string{"foo", "bar"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"ooroodoofoodtoo", []string{"foo", "doo", "roo", "tee", "oo"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"abc", []string{"a", "b", "c"}},
ans30{[]int{0}},
},
- question30{
+ {
para30{"a", []string{"b"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"ab", []string{"ba"}},
ans30{[]int{}},
},
- question30{
+ {
para30{"n", []string{}},
ans30{[]int{}},
},
diff --git a/leetcode/0033.Search-in-Rotated-Sorted-Array/33. Search in Rotated Sorted Array_test.go b/leetcode/0033.Search-in-Rotated-Sorted-Array/33. Search in Rotated Sorted Array_test.go
index 3fcfbb5a..b31eca3b 100644
--- a/leetcode/0033.Search-in-Rotated-Sorted-Array/33. Search in Rotated Sorted Array_test.go
+++ b/leetcode/0033.Search-in-Rotated-Sorted-Array/33. Search in Rotated Sorted Array_test.go
@@ -27,17 +27,17 @@ func Test_Problem33(t *testing.T) {
qs := []question33{
- question33{
+ {
para33{[]int{3, 1}, 1},
ans33{1},
},
- question33{
+ {
para33{[]int{4, 5, 6, 7, 0, 1, 2}, 0},
ans33{4},
},
- question33{
+ {
para33{[]int{4, 5, 6, 7, 0, 1, 2}, 3},
ans33{-1},
},
diff --git a/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array/34. Find First and Last Position of Element in Sorted Array_test.go b/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array/34. Find First and Last Position of Element in Sorted Array_test.go
index 52d408aa..c8bd3306 100644
--- a/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array/34. Find First and Last Position of Element in Sorted Array_test.go
+++ b/leetcode/0034.Find-First-and-Last-Position-of-Element-in-Sorted-Array/34. Find First and Last Position of Element in Sorted Array_test.go
@@ -27,12 +27,12 @@ func Test_Problem34(t *testing.T) {
qs := []question34{
- question34{
+ {
para34{[]int{5, 7, 7, 8, 8, 10}, 8},
ans34{[]int{3, 4}},
},
- question34{
+ {
para34{[]int{5, 7, 7, 8, 8, 10}, 6},
ans34{[]int{-1, -1}},
},
diff --git a/leetcode/0035.Search-Insert-Position/35. Search Insert Position_test.go b/leetcode/0035.Search-Insert-Position/35. Search Insert Position_test.go
index 6947076c..1b9a30bc 100644
--- a/leetcode/0035.Search-Insert-Position/35. Search Insert Position_test.go
+++ b/leetcode/0035.Search-Insert-Position/35. Search Insert Position_test.go
@@ -27,22 +27,22 @@ func Test_Problem35(t *testing.T) {
qs := []question35{
- question35{
+ {
para35{[]int{1, 3, 5, 6}, 5},
ans35{2},
},
- question35{
+ {
para35{[]int{1, 3, 5, 6}, 2},
ans35{1},
},
- question35{
+ {
para35{[]int{1, 3, 5, 6}, 7},
ans35{4},
},
- question35{
+ {
para35{[]int{1, 3, 5, 6}, 0},
ans35{0},
},
diff --git a/leetcode/0036.Valid-Sudoku/36. Valid Sudoku_test.go b/leetcode/0036.Valid-Sudoku/36. Valid Sudoku_test.go
index 0d4ad83b..0477efaa 100644
--- a/leetcode/0036.Valid-Sudoku/36. Valid Sudoku_test.go
+++ b/leetcode/0036.Valid-Sudoku/36. Valid Sudoku_test.go
@@ -26,45 +26,45 @@ func Test_Problem36(t *testing.T) {
qs := []question36{
- question36{
+ {
para36{[][]byte{
- []byte{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
- []byte{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
- []byte{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
- []byte{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
- []byte{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
- []byte{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
- []byte{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
- []byte{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
- []byte{'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
+ {'5', '3', '.', '.', '7', '.', '.', '.', '.'},
+ {'6', '.', '.', '1', '9', '5', '.', '.', '.'},
+ {'.', '9', '8', '.', '.', '.', '.', '6', '.'},
+ {'8', '.', '.', '.', '6', '.', '.', '.', '3'},
+ {'4', '.', '.', '8', '.', '3', '.', '.', '1'},
+ {'7', '.', '.', '.', '2', '.', '.', '.', '6'},
+ {'.', '6', '.', '.', '.', '.', '2', '8', '.'},
+ {'.', '.', '.', '4', '1', '9', '.', '.', '5'},
+ {'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
ans36{true},
},
- question36{
+ {
para36{[][]byte{
- []byte{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
- []byte{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
- []byte{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
- []byte{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
- []byte{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
- []byte{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
- []byte{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
- []byte{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
- []byte{'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
+ {'8', '3', '.', '.', '7', '.', '.', '.', '.'},
+ {'6', '.', '.', '1', '9', '5', '.', '.', '.'},
+ {'.', '9', '8', '.', '.', '.', '.', '6', '.'},
+ {'8', '.', '.', '.', '6', '.', '.', '.', '3'},
+ {'4', '.', '.', '8', '.', '3', '.', '.', '1'},
+ {'7', '.', '.', '.', '2', '.', '.', '.', '6'},
+ {'.', '6', '.', '.', '.', '.', '2', '8', '.'},
+ {'.', '.', '.', '4', '1', '9', '.', '.', '5'},
+ {'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
ans36{false},
},
- question36{
+ {
para36{[][]byte{
- []byte{'.', '8', '7', '6', '5', '4', '3', '2', '1'},
- []byte{'2', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'3', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'4', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'5', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'6', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'7', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'8', '.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'9', '.', '.', '.', '.', '.', '.', '.', '.'}}},
+ {'.', '8', '7', '6', '5', '4', '3', '2', '1'},
+ {'2', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'3', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'4', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'5', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'6', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'7', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'8', '.', '.', '.', '.', '.', '.', '.', '.'},
+ {'9', '.', '.', '.', '.', '.', '.', '.', '.'}}},
ans36{true},
},
}
diff --git a/leetcode/0037.Sudoku-Solver/37. Sudoku Solver_test.go b/leetcode/0037.Sudoku-Solver/37. Sudoku Solver_test.go
index b6b71f81..d56bd362 100644
--- a/leetcode/0037.Sudoku-Solver/37. Sudoku Solver_test.go
+++ b/leetcode/0037.Sudoku-Solver/37. Sudoku Solver_test.go
@@ -26,27 +26,27 @@ func Test_Problem37(t *testing.T) {
qs := []question37{
- question37{
+ {
para37{[][]byte{
- []byte{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
- []byte{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
- []byte{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
- []byte{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
- []byte{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
- []byte{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
- []byte{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
- []byte{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
- []byte{'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
+ {'5', '3', '.', '.', '7', '.', '.', '.', '.'},
+ {'6', '.', '.', '1', '9', '5', '.', '.', '.'},
+ {'.', '9', '8', '.', '.', '.', '.', '6', '.'},
+ {'8', '.', '.', '.', '6', '.', '.', '.', '3'},
+ {'4', '.', '.', '8', '.', '3', '.', '.', '1'},
+ {'7', '.', '.', '.', '2', '.', '.', '.', '6'},
+ {'.', '6', '.', '.', '.', '.', '2', '8', '.'},
+ {'.', '.', '.', '4', '1', '9', '.', '.', '5'},
+ {'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
ans37{[][]byte{
- []byte{'5', '3', '4', '6', '7', '8', '9', '1', '2'},
- []byte{'6', '7', '2', '1', '9', '5', '3', '4', '8'},
- []byte{'1', '9', '8', '3', '4', '2', '5', '6', '7'},
- []byte{'8', '5', '9', '7', '6', '1', '4', '2', '3'},
- []byte{'4', '2', '6', '8', '5', '3', '7', '9', '1'},
- []byte{'7', '1', '3', '9', '2', '4', '8', '5', '6'},
- []byte{'9', '6', '1', '5', '3', '7', '2', '8', '4'},
- []byte{'2', '8', '7', '4', '1', '9', '6', '3', '5'},
- []byte{'3', '4', '5', '2', '8', '6', '1', '7', '9'}}},
+ {'5', '3', '4', '6', '7', '8', '9', '1', '2'},
+ {'6', '7', '2', '1', '9', '5', '3', '4', '8'},
+ {'1', '9', '8', '3', '4', '2', '5', '6', '7'},
+ {'8', '5', '9', '7', '6', '1', '4', '2', '3'},
+ {'4', '2', '6', '8', '5', '3', '7', '9', '1'},
+ {'7', '1', '3', '9', '2', '4', '8', '5', '6'},
+ {'9', '6', '1', '5', '3', '7', '2', '8', '4'},
+ {'2', '8', '7', '4', '1', '9', '6', '3', '5'},
+ {'3', '4', '5', '2', '8', '6', '1', '7', '9'}}},
},
}
diff --git a/leetcode/0039.Combination-Sum/39. Combination Sum_test.go b/leetcode/0039.Combination-Sum/39. Combination Sum_test.go
index b6df4147..8b3a3568 100644
--- a/leetcode/0039.Combination-Sum/39. Combination Sum_test.go
+++ b/leetcode/0039.Combination-Sum/39. Combination Sum_test.go
@@ -27,14 +27,14 @@ func Test_Problem39(t *testing.T) {
qs := []question39{
- question39{
+ {
para39{[]int{2, 3, 6, 7}, 7},
- ans39{[][]int{[]int{7}, []int{2, 2, 3}}},
+ ans39{[][]int{{7}, {2, 2, 3}}},
},
- question39{
+ {
para39{[]int{2, 3, 5}, 8},
- ans39{[][]int{[]int{2, 2, 2, 2}, []int{2, 3, 3}, []int{3, 5}}},
+ ans39{[][]int{{2, 2, 2, 2}, {2, 3, 3}, {3, 5}}},
},
}
diff --git a/leetcode/0040.Combination-Sum-II/40. Combination Sum II_test.go b/leetcode/0040.Combination-Sum-II/40. Combination Sum II_test.go
index ef971623..8c46b3f7 100644
--- a/leetcode/0040.Combination-Sum-II/40. Combination Sum II_test.go
+++ b/leetcode/0040.Combination-Sum-II/40. Combination Sum II_test.go
@@ -27,14 +27,14 @@ func Test_Problem40(t *testing.T) {
qs := []question40{
- question40{
+ {
para40{[]int{10, 1, 2, 7, 6, 1, 5}, 8},
- ans40{[][]int{[]int{1, 7}, []int{1, 2, 5}, []int{2, 6}, []int{1, 1, 6}}},
+ ans40{[][]int{{1, 7}, {1, 2, 5}, {2, 6}, {1, 1, 6}}},
},
- question40{
+ {
para40{[]int{2, 5, 2, 1, 2}, 5},
- ans40{[][]int{[]int{1, 2, 2}, []int{5}}},
+ ans40{[][]int{{1, 2, 2}, {5}}},
},
}
diff --git a/leetcode/0041.First-Missing-Positive/41. First Missing Positive_test.go b/leetcode/0041.First-Missing-Positive/41. First Missing Positive_test.go
index e1d0ba59..0edd5c0d 100644
--- a/leetcode/0041.First-Missing-Positive/41. First Missing Positive_test.go
+++ b/leetcode/0041.First-Missing-Positive/41. First Missing Positive_test.go
@@ -26,37 +26,37 @@ func Test_Problem41(t *testing.T) {
qs := []question41{
- question41{
+ {
para41{[]int{10, -1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, -3}},
ans41{6},
},
- question41{
+ {
para41{[]int{10, -1, 8, 6, 7, 3, -2, 5, 4, 2, 1, -3}},
ans41{9},
},
- question41{
+ {
para41{[]int{1}},
ans41{2},
},
- question41{
+ {
para41{[]int{0, 2, 2, 1, 1}},
ans41{3},
},
- question41{
+ {
para41{[]int{}},
ans41{1},
},
- question41{
+ {
para41{[]int{1, 2, 0}},
ans41{3},
},
- question41{
+ {
para41{[]int{3, 4, -1, 1}},
ans41{2},
},
diff --git a/leetcode/0042.Trapping-Rain-Water/42. Trapping Rain Water_test.go b/leetcode/0042.Trapping-Rain-Water/42. Trapping Rain Water_test.go
index a6dc5684..918f5ebb 100644
--- a/leetcode/0042.Trapping-Rain-Water/42. Trapping Rain Water_test.go
+++ b/leetcode/0042.Trapping-Rain-Water/42. Trapping Rain Water_test.go
@@ -26,7 +26,7 @@ func Test_Problem42(t *testing.T) {
qs := []question42{
- question42{
+ {
para42{[]int{0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}},
ans42{6},
},
diff --git a/leetcode/0046.Permutations/46. Permutations_test.go b/leetcode/0046.Permutations/46. Permutations_test.go
index 74938e15..d90a4e9c 100644
--- a/leetcode/0046.Permutations/46. Permutations_test.go
+++ b/leetcode/0046.Permutations/46. Permutations_test.go
@@ -26,9 +26,9 @@ func Test_Problem46(t *testing.T) {
qs := []question46{
- question46{
+ {
para46{[]int{1, 2, 3}},
- ans46{[][]int{[]int{1, 2, 3}, []int{1, 3, 2}, []int{2, 1, 3}, []int{2, 3, 1}, []int{3, 1, 2}, []int{3, 2, 1}}},
+ ans46{[][]int{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}},
},
}
diff --git a/leetcode/0047.Permutations-II/47. Permutations II_test.go b/leetcode/0047.Permutations-II/47. Permutations II_test.go
index 23393075..f997b9a9 100644
--- a/leetcode/0047.Permutations-II/47. Permutations II_test.go
+++ b/leetcode/0047.Permutations-II/47. Permutations II_test.go
@@ -26,19 +26,19 @@ func Test_Problem47(t *testing.T) {
qs := []question47{
- question47{
+ {
para47{[]int{1, 1, 2}},
- ans47{[][]int{[]int{1, 1, 2}, []int{1, 2, 1}, []int{2, 1, 1}}},
+ ans47{[][]int{{1, 1, 2}, {1, 2, 1}, {2, 1, 1}}},
},
- question47{
+ {
para47{[]int{1, 2, 2}},
- ans47{[][]int{[]int{1, 2, 2}, []int{2, 2, 1}, []int{2, 1, 2}}},
+ ans47{[][]int{{1, 2, 2}, {2, 2, 1}, {2, 1, 2}}},
},
- question47{
+ {
para47{[]int{2, 2, 2}},
- ans47{[][]int{[]int{2, 2, 2}}},
+ ans47{[][]int{{2, 2, 2}}},
},
}
diff --git a/leetcode/0048.Rotate-Image/48. Rotate Image_test.go b/leetcode/0048.Rotate-Image/48. Rotate Image_test.go
index 2f5278ae..76f8f704 100644
--- a/leetcode/0048.Rotate-Image/48. Rotate Image_test.go
+++ b/leetcode/0048.Rotate-Image/48. Rotate Image_test.go
@@ -26,14 +26,14 @@ func Test_Problem48(t *testing.T) {
qs := []question48{
- question48{
- para48{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}},
- ans48{[][]int{[]int{7, 4, 1}, []int{8, 5, 2}, []int{9, 6, 3}}},
+ {
+ para48{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}},
+ ans48{[][]int{{7, 4, 1}, {8, 5, 2}, {9, 6, 3}}},
},
- question48{
- para48{[][]int{[]int{5, 1, 9, 11}, []int{2, 4, 8, 10}, []int{13, 3, 6, 7}, []int{15, 14, 12, 16}}},
- ans48{[][]int{[]int{15, 13, 2, 5}, []int{14, 3, 4, 1}, []int{12, 6, 8, 9}, []int{16, 7, 10, 11}}},
+ {
+ para48{[][]int{{5, 1, 9, 11}, {2, 4, 8, 10}, {13, 3, 6, 7}, {15, 14, 12, 16}}},
+ ans48{[][]int{{15, 13, 2, 5}, {14, 3, 4, 1}, {12, 6, 8, 9}, {16, 7, 10, 11}}},
},
}
diff --git a/leetcode/0049.Group-Anagrams/49. Group Anagrams_test.go b/leetcode/0049.Group-Anagrams/49. Group Anagrams_test.go
index f7c537cc..bee3e303 100644
--- a/leetcode/0049.Group-Anagrams/49. Group Anagrams_test.go
+++ b/leetcode/0049.Group-Anagrams/49. Group Anagrams_test.go
@@ -26,9 +26,9 @@ func Test_Problem49(t *testing.T) {
qs := []question49{
- question49{
+ {
para49{[]string{"eat", "tea", "tan", "ate", "nat", "bat"}},
- ans49{[][]string{[]string{"ate", "eat", "tea"}, []string{"nat", "tan"}, []string{"bat"}}},
+ ans49{[][]string{{"ate", "eat", "tea"}, {"nat", "tan"}, {"bat"}}},
},
}
diff --git a/leetcode/0050.Powx-n/50. Pow(x, n)_test.go b/leetcode/0050.Powx-n/50. Pow(x, n)_test.go
index b542b446..2558a1b6 100644
--- a/leetcode/0050.Powx-n/50. Pow(x, n)_test.go
+++ b/leetcode/0050.Powx-n/50. Pow(x, n)_test.go
@@ -27,17 +27,17 @@ func Test_Problem50(t *testing.T) {
qs := []question50{
- question50{
+ {
para50{2.00000, 10},
ans50{1024.00000},
},
- question50{
+ {
para50{2.10000, 3},
ans50{9.26100},
},
- question50{
+ {
para50{2.00000, -2},
ans50{0.25000},
},
diff --git a/leetcode/0051.N-Queens/51. N-Queens_test.go b/leetcode/0051.N-Queens/51. N-Queens_test.go
index ad665328..2f6cfd17 100644
--- a/leetcode/0051.N-Queens/51. N-Queens_test.go
+++ b/leetcode/0051.N-Queens/51. N-Queens_test.go
@@ -26,14 +26,14 @@ func Test_Problem51(t *testing.T) {
qs := []question51{
- question51{
+ {
para51{4},
ans51{[][]string{
- []string{".Q..",
+ {".Q..",
"...Q",
"Q...",
"..Q."},
- []string{"..Q.",
+ {"..Q.",
"Q...",
"...Q",
".Q.."},
diff --git a/leetcode/0052.N-Queens-II/52. N-Queens II_test.go b/leetcode/0052.N-Queens-II/52. N-Queens II_test.go
index 672af899..a906c2a6 100644
--- a/leetcode/0052.N-Queens-II/52. N-Queens II_test.go
+++ b/leetcode/0052.N-Queens-II/52. N-Queens II_test.go
@@ -26,51 +26,51 @@ func Test_Problem52(t *testing.T) {
qs := []question52{
- question52{
+ {
para52{1},
ans52{1},
},
- question52{
+ {
para52{2},
ans52{0},
},
- question52{
+ {
para52{3},
ans52{0},
},
- question52{
+ {
para52{4},
ans52{2},
},
- question52{
+ {
para52{5},
ans52{10},
},
- question52{
+ {
para52{6},
ans52{4},
},
- question52{
+ {
para52{7},
ans52{40},
},
- question52{
+ {
para52{8},
ans52{92},
},
- question52{
+ {
para52{9},
ans52{352},
},
- question52{
+ {
para52{10},
ans52{724},
},
diff --git a/leetcode/0053.Maximum-Subarray/53. Maximum Subarray_test.go b/leetcode/0053.Maximum-Subarray/53. Maximum Subarray_test.go
index 04e07b05..0a99d22f 100644
--- a/leetcode/0053.Maximum-Subarray/53. Maximum Subarray_test.go
+++ b/leetcode/0053.Maximum-Subarray/53. Maximum Subarray_test.go
@@ -26,21 +26,21 @@ func Test_Problem53(t *testing.T) {
qs := []question53{
- question53{
+ {
para53{[]int{-2, 1, -3, 4, -1, 2, 1, -5, 4}},
ans53{6},
},
- question53{
+ {
para53{[]int{2, 7, 9, 3, 1}},
ans53{22},
},
- question53{
+ {
para53{[]int{2}},
ans53{2},
},
- question53{
+ {
para53{[]int{-1, -2}},
ans53{-1},
},
diff --git a/leetcode/0054.Spiral-Matrix/54. Spiral Matrix.go b/leetcode/0054.Spiral-Matrix/54. Spiral Matrix.go
index ae2ae116..93bb3564 100644
--- a/leetcode/0054.Spiral-Matrix/54. Spiral Matrix.go
+++ b/leetcode/0054.Spiral-Matrix/54. Spiral Matrix.go
@@ -19,10 +19,10 @@ func spiralOrder(matrix [][]int) []int {
return res
}
visit, m, n, round, x, y, spDir := make([][]int, len(matrix)), len(matrix), len(matrix[0]), 0, 0, 0, [][]int{
- []int{0, 1}, // 朝右
- []int{1, 0}, // 朝下
- []int{0, -1}, // 朝左
- []int{-1, 0}, // 朝上
+ {0, 1}, // 朝右
+ {1, 0}, // 朝下
+ {0, -1}, // 朝左
+ {-1, 0}, // 朝上
}
for i := 0; i < m; i++ {
visit[i] = make([]int, n)
diff --git a/leetcode/0054.Spiral-Matrix/54. Spiral Matrix_test.go b/leetcode/0054.Spiral-Matrix/54. Spiral Matrix_test.go
index e7af57f1..39e0d2ec 100644
--- a/leetcode/0054.Spiral-Matrix/54. Spiral Matrix_test.go
+++ b/leetcode/0054.Spiral-Matrix/54. Spiral Matrix_test.go
@@ -26,27 +26,27 @@ func Test_Problem54(t *testing.T) {
qs := []question54{
- question54{
- para54{[][]int{[]int{3}, []int{2}}},
+ {
+ para54{[][]int{{3}, {2}}},
ans54{[]int{3, 2}},
},
- question54{
- para54{[][]int{[]int{2, 3}}},
+ {
+ para54{[][]int{{2, 3}}},
ans54{[]int{2, 3}},
},
- question54{
- para54{[][]int{[]int{1}}},
+ {
+ para54{[][]int{{1}}},
ans54{[]int{1}},
},
- question54{
- para54{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}},
+ {
+ para54{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}},
ans54{[]int{1, 2, 3, 6, 9, 8, 7, 4, 5}},
},
- question54{
- para54{[][]int{[]int{1, 2, 3, 4}, []int{5, 6, 7, 8}, []int{9, 10, 11, 12}}},
+ {
+ para54{[][]int{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}},
ans54{[]int{1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7}},
},
}
diff --git a/leetcode/0055.Jump-Game/55. Jump Game_test.go b/leetcode/0055.Jump-Game/55. Jump Game_test.go
index 8dfd10b6..e4e47e31 100644
--- a/leetcode/0055.Jump-Game/55. Jump Game_test.go
+++ b/leetcode/0055.Jump-Game/55. Jump Game_test.go
@@ -26,11 +26,11 @@ func Test_Problem55(t *testing.T) {
qs := []question55{
- question55{
+ {
para55{[]int{2, 3, 1, 1, 4}},
ans55{true},
},
- question55{
+ {
para55{[]int{3, 2, 1, 0, 4}},
ans55{false},
},
diff --git a/leetcode/0056.Merge-Intervals/56. Merge Intervals_test.go b/leetcode/0056.Merge-Intervals/56. Merge Intervals_test.go
index 30232c71..25cd44ba 100644
--- a/leetcode/0056.Merge-Intervals/56. Merge Intervals_test.go
+++ b/leetcode/0056.Merge-Intervals/56. Merge Intervals_test.go
@@ -26,39 +26,39 @@ func Test_Problem56(t *testing.T) {
qs := []question56{
- question56{
+ {
para56{[]Interval{}},
ans56{[]Interval{}},
},
- question56{
- para56{[]Interval{Interval{Start: 1, End: 3}, Interval{Start: 2, End: 6}, Interval{Start: 8, End: 10}, Interval{Start: 15, End: 18}}},
- ans56{[]Interval{Interval{Start: 1, End: 6}, Interval{Start: 8, End: 10}, Interval{Start: 15, End: 18}}},
+ {
+ para56{[]Interval{{Start: 1, End: 3}, {Start: 2, End: 6}, {Start: 8, End: 10}, {Start: 15, End: 18}}},
+ ans56{[]Interval{{Start: 1, End: 6}, {Start: 8, End: 10}, {Start: 15, End: 18}}},
},
- question56{
- para56{[]Interval{Interval{Start: 1, End: 4}, Interval{Start: 4, End: 5}}},
- ans56{[]Interval{Interval{Start: 1, End: 5}}},
+ {
+ para56{[]Interval{{Start: 1, End: 4}, {Start: 4, End: 5}}},
+ ans56{[]Interval{{Start: 1, End: 5}}},
},
- question56{
- para56{[]Interval{Interval{Start: 1, End: 3}, Interval{Start: 3, End: 6}, Interval{Start: 5, End: 10}, Interval{Start: 9, End: 18}}},
- ans56{[]Interval{Interval{Start: 1, End: 18}}},
+ {
+ para56{[]Interval{{Start: 1, End: 3}, {Start: 3, End: 6}, {Start: 5, End: 10}, {Start: 9, End: 18}}},
+ ans56{[]Interval{{Start: 1, End: 18}}},
},
- question56{
- para56{[]Interval{Interval{Start: 15, End: 18}, Interval{Start: 8, End: 10}, Interval{Start: 2, End: 6}, Interval{Start: 1, End: 3}}},
- ans56{[]Interval{Interval{Start: 1, End: 6}, Interval{Start: 8, End: 10}, Interval{Start: 15, End: 18}}},
+ {
+ para56{[]Interval{{Start: 15, End: 18}, {Start: 8, End: 10}, {Start: 2, End: 6}, {Start: 1, End: 3}}},
+ ans56{[]Interval{{Start: 1, End: 6}, {Start: 8, End: 10}, {Start: 15, End: 18}}},
},
- question56{
- para56{[]Interval{Interval{Start: 1, End: 3}, Interval{Start: 2, End: 6}, Interval{Start: 8, End: 10}, Interval{Start: 15, End: 18}}},
- ans56{[]Interval{Interval{Start: 1, End: 6}, Interval{Start: 8, End: 10}, Interval{Start: 15, End: 18}}},
+ {
+ para56{[]Interval{{Start: 1, End: 3}, {Start: 2, End: 6}, {Start: 8, End: 10}, {Start: 15, End: 18}}},
+ ans56{[]Interval{{Start: 1, End: 6}, {Start: 8, End: 10}, {Start: 15, End: 18}}},
},
- question56{
- para56{[]Interval{Interval{Start: 1, End: 4}, Interval{Start: 1, End: 5}}},
- ans56{[]Interval{Interval{Start: 1, End: 5}}},
+ {
+ para56{[]Interval{{Start: 1, End: 4}, {Start: 1, End: 5}}},
+ ans56{[]Interval{{Start: 1, End: 5}}},
},
}
diff --git a/leetcode/0057.Insert-Interval/57. Insert Interval_test.go b/leetcode/0057.Insert-Interval/57. Insert Interval_test.go
index 9ce3a7b3..8923829c 100644
--- a/leetcode/0057.Insert-Interval/57. Insert Interval_test.go
+++ b/leetcode/0057.Insert-Interval/57. Insert Interval_test.go
@@ -27,34 +27,34 @@ func Test_Problem57(t *testing.T) {
qs := []question57{
- question57{
+ {
para57{[]Interval{}, Interval{}},
ans57{[]Interval{}},
},
- question57{
- para57{[]Interval{Interval{Start: 1, End: 3}, Interval{Start: 6, End: 9}}, Interval{Start: 4, End: 8}},
- ans57{[]Interval{Interval{Start: 1, End: 5}, Interval{Start: 6, End: 9}}},
+ {
+ para57{[]Interval{{Start: 1, End: 3}, {Start: 6, End: 9}}, Interval{Start: 4, End: 8}},
+ ans57{[]Interval{{Start: 1, End: 5}, {Start: 6, End: 9}}},
},
- question57{
- para57{[]Interval{Interval{Start: 1, End: 3}, Interval{Start: 6, End: 9}}, Interval{Start: 2, End: 5}},
- ans57{[]Interval{Interval{Start: 1, End: 5}, Interval{Start: 6, End: 9}}},
+ {
+ para57{[]Interval{{Start: 1, End: 3}, {Start: 6, End: 9}}, Interval{Start: 2, End: 5}},
+ ans57{[]Interval{{Start: 1, End: 5}, {Start: 6, End: 9}}},
},
- question57{
- para57{[]Interval{Interval{Start: 1, End: 2}, Interval{Start: 3, End: 5}, Interval{Start: 6, End: 7}, Interval{Start: 8, End: 10}, Interval{Start: 12, End: 16}}, Interval{Start: 4, End: 8}},
- ans57{[]Interval{Interval{Start: 1, End: 2}, Interval{Start: 3, End: 10}, Interval{Start: 12, End: 16}}},
+ {
+ para57{[]Interval{{Start: 1, End: 2}, {Start: 3, End: 5}, {Start: 6, End: 7}, {Start: 8, End: 10}, {Start: 12, End: 16}}, Interval{Start: 4, End: 8}},
+ ans57{[]Interval{{Start: 1, End: 2}, {Start: 3, End: 10}, {Start: 12, End: 16}}},
},
- question57{
- para57{[]Interval{Interval{Start: 1, End: 5}}, Interval{Start: 5, End: 7}},
- ans57{[]Interval{Interval{Start: 1, End: 7}}},
+ {
+ para57{[]Interval{{Start: 1, End: 5}}, Interval{Start: 5, End: 7}},
+ ans57{[]Interval{{Start: 1, End: 7}}},
},
- question57{
- para57{[]Interval{Interval{Start: 1, End: 2}, Interval{Start: 3, End: 5}, Interval{Start: 6, End: 7}, Interval{Start: 8, End: 10}, Interval{Start: 12, End: 16}}, Interval{Start: 9, End: 12}},
- ans57{[]Interval{Interval{Start: 1, End: 2}, Interval{Start: 3, End: 5}, Interval{Start: 6, End: 7}, Interval{Start: 8, End: 16}}},
+ {
+ para57{[]Interval{{Start: 1, End: 2}, {Start: 3, End: 5}, {Start: 6, End: 7}, {Start: 8, End: 10}, {Start: 12, End: 16}}, Interval{Start: 9, End: 12}},
+ ans57{[]Interval{{Start: 1, End: 2}, {Start: 3, End: 5}, {Start: 6, End: 7}, {Start: 8, End: 16}}},
},
}
diff --git a/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II.go b/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II.go
index 8fc1def4..aa1657f0 100644
--- a/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II.go
+++ b/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II.go
@@ -5,13 +5,13 @@ func generateMatrix(n int) [][]int {
return [][]int{}
}
if n == 1 {
- return [][]int{[]int{1}}
+ return [][]int{{1}}
}
res, visit, round, x, y, spDir := make([][]int, n), make([][]int, n), 0, 0, 0, [][]int{
- []int{0, 1}, // 朝右
- []int{1, 0}, // 朝下
- []int{0, -1}, // 朝左
- []int{-1, 0}, // 朝上
+ {0, 1}, // 朝右
+ {1, 0}, // 朝下
+ {0, -1}, // 朝左
+ {-1, 0}, // 朝上
}
for i := 0; i < n; i++ {
visit[i] = make([]int, n)
diff --git a/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II_test.go b/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II_test.go
index 8448ced6..be43c350 100644
--- a/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II_test.go
+++ b/leetcode/0059.Spiral-Matrix-II/59. Spiral Matrix II_test.go
@@ -26,14 +26,14 @@ func Test_Problem59(t *testing.T) {
qs := []question59{
- question59{
+ {
para59{3},
- ans59{[][]int{[]int{1, 2, 3}, []int{8, 9, 4}, []int{7, 6, 5}}},
+ ans59{[][]int{{1, 2, 3}, {8, 9, 4}, {7, 6, 5}}},
},
- question59{
+ {
para59{4},
- ans59{[][]int{[]int{1, 2, 3, 4}, []int{12, 13, 14, 5}, []int{11, 16, 15, 6}, []int{10, 9, 8, 7}}},
+ ans59{[][]int{{1, 2, 3, 4}, {12, 13, 14, 5}, {11, 16, 15, 6}, {10, 9, 8, 7}}},
},
}
diff --git a/leetcode/0060.Permutation-Sequence/60. Permutation Sequence_test.go b/leetcode/0060.Permutation-Sequence/60. Permutation Sequence_test.go
index 7e14fb4e..b9805ed2 100644
--- a/leetcode/0060.Permutation-Sequence/60. Permutation Sequence_test.go
+++ b/leetcode/0060.Permutation-Sequence/60. Permutation Sequence_test.go
@@ -27,12 +27,12 @@ func Test_Problem60(t *testing.T) {
qs := []question60{
- question60{
+ {
para60{3, 3},
ans60{"213"},
},
- question60{
+ {
para60{4, 9},
ans60{"2314"},
},
diff --git a/leetcode/0061.Rotate-List/61. Rotate List_test.go b/leetcode/0061.Rotate-List/61. Rotate List_test.go
index 98f82957..7df9e550 100644
--- a/leetcode/0061.Rotate-List/61. Rotate List_test.go
+++ b/leetcode/0061.Rotate-List/61. Rotate List_test.go
@@ -29,32 +29,32 @@ func Test_Problem61(t *testing.T) {
qs := []question61{
- question61{
+ {
para61{[]int{1, 2, 3, 4, 5}, 2},
ans61{[]int{4, 5, 1, 2, 3}},
},
- question61{
+ {
para61{[]int{1, 2, 3, 4, 5}, 3},
ans61{[]int{4, 5, 1, 2, 3}},
},
- question61{
+ {
para61{[]int{0, 1, 2}, 4},
ans61{[]int{2, 0, 1}},
},
- question61{
+ {
para61{[]int{1, 1, 1, 2}, 3},
ans61{[]int{1, 1, 2, 1}},
},
- question61{
+ {
para61{[]int{1}, 10},
ans61{[]int{1}},
},
- question61{
+ {
para61{[]int{}, 100},
ans61{[]int{}},
},
diff --git a/leetcode/0062.Unique-Paths/62. Unique Paths_test.go b/leetcode/0062.Unique-Paths/62. Unique Paths_test.go
index 00fad12e..e5e7f657 100644
--- a/leetcode/0062.Unique-Paths/62. Unique Paths_test.go
+++ b/leetcode/0062.Unique-Paths/62. Unique Paths_test.go
@@ -27,17 +27,17 @@ func Test_Problem62(t *testing.T) {
qs := []question62{
- question62{
+ {
para62{3, 2},
ans62{3},
},
- question62{
+ {
para62{7, 3},
ans62{28},
},
- question62{
+ {
para62{1, 2},
ans62{1},
},
diff --git a/leetcode/0063.Unique-Paths-II/63. Unique Paths II_test.go b/leetcode/0063.Unique-Paths-II/63. Unique Paths II_test.go
index 03536295..e8bf8028 100644
--- a/leetcode/0063.Unique-Paths-II/63. Unique Paths II_test.go
+++ b/leetcode/0063.Unique-Paths-II/63. Unique Paths II_test.go
@@ -26,29 +26,29 @@ func Test_Problem63(t *testing.T) {
qs := []question63{
- question63{
+ {
para63{[][]int{
- []int{0, 0, 0},
- []int{0, 1, 0},
- []int{0, 0, 0},
+ {0, 0, 0},
+ {0, 1, 0},
+ {0, 0, 0},
}},
ans63{2},
},
- question63{
+ {
para63{[][]int{
- []int{0, 0},
- []int{1, 1},
- []int{0, 0},
+ {0, 0},
+ {1, 1},
+ {0, 0},
}},
ans63{0},
},
- question63{
+ {
para63{[][]int{
- []int{0, 1, 0, 0},
- []int{1, 0, 0, 0},
- []int{0, 0, 0, 0},
+ {0, 1, 0, 0},
+ {1, 0, 0, 0},
+ {0, 0, 0, 0},
}},
ans63{0},
},
diff --git a/leetcode/0064.Minimum-Path-Sum/64. Minimum Path Sum_test.go b/leetcode/0064.Minimum-Path-Sum/64. Minimum Path Sum_test.go
index ab560530..afbfcacd 100644
--- a/leetcode/0064.Minimum-Path-Sum/64. Minimum Path Sum_test.go
+++ b/leetcode/0064.Minimum-Path-Sum/64. Minimum Path Sum_test.go
@@ -26,11 +26,11 @@ func Test_Problem64(t *testing.T) {
qs := []question64{
- question64{
+ {
para64{[][]int{
- []int{1, 3, 1},
- []int{1, 5, 1},
- []int{4, 2, 1},
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1},
}},
ans64{7},
},
diff --git a/leetcode/0066.Plus-One/66. Plus One_test.go b/leetcode/0066.Plus-One/66. Plus One_test.go
index 0a72dea8..cc112f4d 100644
--- a/leetcode/0066.Plus-One/66. Plus One_test.go
+++ b/leetcode/0066.Plus-One/66. Plus One_test.go
@@ -26,22 +26,22 @@ func Test_Problem66(t *testing.T) {
qs := []question66{
- question66{
+ {
para66{[]int{1, 2, 3}},
ans66{[]int{1, 2, 4}},
},
- question66{
+ {
para66{[]int{4, 3, 2, 1}},
ans66{[]int{4, 3, 2, 2}},
},
- question66{
+ {
para66{[]int{9, 9}},
ans66{[]int{1, 0, 0}},
},
- question66{
+ {
para66{[]int{0}},
ans66{[]int{0}},
},
diff --git a/leetcode/0067.Add-Binary/67. Add Binary_test.go b/leetcode/0067.Add-Binary/67. Add Binary_test.go
index 50746ef5..29adc0cd 100644
--- a/leetcode/0067.Add-Binary/67. Add Binary_test.go
+++ b/leetcode/0067.Add-Binary/67. Add Binary_test.go
@@ -27,12 +27,12 @@ func Test_Problem67(t *testing.T) {
qs := []question67{
- question67{
+ {
para67{"11", "1"},
ans67{"100"},
},
- question67{
+ {
para67{"1010", "1011"},
ans67{"10101"},
},
diff --git a/leetcode/0069.Sqrtx/69. Sqrt(x)_test.go b/leetcode/0069.Sqrtx/69. Sqrt(x)_test.go
index 69e59cfc..b3188348 100644
--- a/leetcode/0069.Sqrtx/69. Sqrt(x)_test.go
+++ b/leetcode/0069.Sqrtx/69. Sqrt(x)_test.go
@@ -26,12 +26,12 @@ func Test_Problem69(t *testing.T) {
qs := []question69{
- question69{
+ {
para69{4},
ans69{2},
},
- question69{
+ {
para69{8},
ans69{2},
},
diff --git a/leetcode/0070.Climbing-Stairs/70. Climbing Stairs_test.go b/leetcode/0070.Climbing-Stairs/70. Climbing Stairs_test.go
index b574248d..02634ec3 100644
--- a/leetcode/0070.Climbing-Stairs/70. Climbing Stairs_test.go
+++ b/leetcode/0070.Climbing-Stairs/70. Climbing Stairs_test.go
@@ -26,12 +26,12 @@ func Test_Problem70(t *testing.T) {
qs := []question70{
- question70{
+ {
para70{2},
ans70{2},
},
- question70{
+ {
para70{3},
ans70{3},
},
diff --git a/leetcode/0071.Simplify-Path/71. Simplify Path_test.go b/leetcode/0071.Simplify-Path/71. Simplify Path_test.go
index 65dd575a..58376921 100644
--- a/leetcode/0071.Simplify-Path/71. Simplify Path_test.go
+++ b/leetcode/0071.Simplify-Path/71. Simplify Path_test.go
@@ -26,42 +26,42 @@ func Test_Problem71(t *testing.T) {
qs := []question71{
- question71{
+ {
para71{"/.hidden"},
ans71{"/.hidden"},
},
- question71{
+ {
para71{"/..hidden"},
ans71{"/..hidden"},
},
- question71{
+ {
para71{"/abc/..."},
ans71{"/abc/..."},
},
- question71{
+ {
para71{"/home/"},
ans71{"/home"},
},
- question71{
+ {
para71{"/..."},
ans71{"/..."},
},
- question71{
+ {
para71{"/../"},
ans71{"/"},
},
- question71{
+ {
para71{"/home//foo/"},
ans71{"/home/foo"},
},
- question71{
+ {
para71{"/a/./b/../../c/"},
ans71{"/c"},
},
diff --git a/leetcode/0074.Search-a-2D-Matrix/74. Search a 2D Matrix_test.go b/leetcode/0074.Search-a-2D-Matrix/74. Search a 2D Matrix_test.go
index 8890b289..9bca5b95 100644
--- a/leetcode/0074.Search-a-2D-Matrix/74. Search a 2D Matrix_test.go
+++ b/leetcode/0074.Search-a-2D-Matrix/74. Search a 2D Matrix_test.go
@@ -27,13 +27,13 @@ func Test_Problem74(t *testing.T) {
qs := []question74{
- question74{
- para74{[][]int{[]int{1, 3, 5, 7}, []int{10, 11, 16, 20}, []int{23, 30, 34, 50}}, 3},
+ {
+ para74{[][]int{{1, 3, 5, 7}, {10, 11, 16, 20}, {23, 30, 34, 50}}, 3},
ans74{true},
},
- question74{
- para74{[][]int{[]int{1, 3, 5, 7}, []int{10, 11, 16, 20}, []int{23, 30, 34, 50}}, 13},
+ {
+ para74{[][]int{{1, 3, 5, 7}, {10, 11, 16, 20}, {23, 30, 34, 50}}, 13},
ans74{false},
},
}
diff --git a/leetcode/0075.Sort-Colors/75. Sort Colors_test.go b/leetcode/0075.Sort-Colors/75. Sort Colors_test.go
index 26ad2003..6feecf3a 100644
--- a/leetcode/0075.Sort-Colors/75. Sort Colors_test.go
+++ b/leetcode/0075.Sort-Colors/75. Sort Colors_test.go
@@ -26,22 +26,22 @@ func Test_Problem75(t *testing.T) {
qs := []question75{
- question75{
+ {
para75{[]int{}},
ans75{[]int{}},
},
- question75{
+ {
para75{[]int{1}},
ans75{[]int{1}},
},
- question75{
+ {
para75{[]int{2, 0, 2, 1, 1, 0}},
ans75{[]int{0, 0, 1, 1, 2, 2}},
},
- question75{
+ {
para75{[]int{2, 0, 1, 1, 2, 0, 2, 1, 2, 0, 0, 0, 1, 2, 2, 2, 0, 1, 1}},
ans75{[]int{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2}},
},
diff --git a/leetcode/0076.Minimum-Window-Substring/76. Minimum Window Substring_test.go b/leetcode/0076.Minimum-Window-Substring/76. Minimum Window Substring_test.go
index 73338f49..95076c7a 100644
--- a/leetcode/0076.Minimum-Window-Substring/76. Minimum Window Substring_test.go
+++ b/leetcode/0076.Minimum-Window-Substring/76. Minimum Window Substring_test.go
@@ -27,17 +27,17 @@ func Test_Problem76(t *testing.T) {
qs := []question76{
- question76{
+ {
para76{"ADOBECODEBANC", "ABC"},
ans76{"BANC"},
},
- question76{
+ {
para76{"a", "aa"},
ans76{""},
},
- question76{
+ {
para76{"a", "a"},
ans76{"a"},
},
diff --git a/leetcode/0077.Combinations/77. Combinations_test.go b/leetcode/0077.Combinations/77. Combinations_test.go
index a5da8b93..4d1a14f3 100644
--- a/leetcode/0077.Combinations/77. Combinations_test.go
+++ b/leetcode/0077.Combinations/77. Combinations_test.go
@@ -27,9 +27,9 @@ func Test_Problem77(t *testing.T) {
qs := []question77{
- question77{
+ {
para77{4, 2},
- ans77{[][]int{[]int{2, 4}, []int{3, 4}, []int{2, 3}, []int{1, 2}, []int{1, 3}, []int{1, 4}}},
+ ans77{[][]int{{2, 4}, {3, 4}, {2, 3}, {1, 2}, {1, 3}, {1, 4}}},
},
}
diff --git a/leetcode/0078.Subsets/78. Subsets_test.go b/leetcode/0078.Subsets/78. Subsets_test.go
index 462ea24d..434f61cb 100644
--- a/leetcode/0078.Subsets/78. Subsets_test.go
+++ b/leetcode/0078.Subsets/78. Subsets_test.go
@@ -26,14 +26,14 @@ func Test_Problem78(t *testing.T) {
qs := []question78{
- question78{
+ {
para78{[]int{}},
- ans78{[][]int{[]int{}}},
+ ans78{[][]int{{}}},
},
- question78{
+ {
para78{[]int{1, 2, 3}},
- ans78{[][]int{[]int{}, []int{1}, []int{2}, []int{3}, []int{1, 2}, []int{2, 3}, []int{1, 3}, []int{1, 2, 3}}},
+ ans78{[][]int{{}, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3}}},
},
}
diff --git a/leetcode/0079.Word-Search/79. Word Search.go b/leetcode/0079.Word-Search/79. Word Search.go
index 6a6bbca5..a2bd2207 100644
--- a/leetcode/0079.Word-Search/79. Word Search.go
+++ b/leetcode/0079.Word-Search/79. Word Search.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func exist(board [][]byte, word string) bool {
diff --git a/leetcode/0079.Word-Search/79. Word Search_test.go b/leetcode/0079.Word-Search/79. Word Search_test.go
index ae47e951..85d992c3 100644
--- a/leetcode/0079.Word-Search/79. Word Search_test.go
+++ b/leetcode/0079.Word-Search/79. Word Search_test.go
@@ -27,69 +27,69 @@ func Test_Problem79(t *testing.T) {
qs := []question79{
- question79{
+ {
para79{[][]byte{
- []byte{'A', 'B', 'C', 'E'},
- []byte{'S', 'F', 'C', 'S'},
- []byte{'A', 'D', 'E', 'E'},
+ {'A', 'B', 'C', 'E'},
+ {'S', 'F', 'C', 'S'},
+ {'A', 'D', 'E', 'E'},
}, "ABCCED"},
ans79{true},
},
- question79{
+ {
para79{[][]byte{
- []byte{'A', 'B', 'C', 'E'},
- []byte{'S', 'F', 'C', 'S'},
- []byte{'A', 'D', 'E', 'E'},
+ {'A', 'B', 'C', 'E'},
+ {'S', 'F', 'C', 'S'},
+ {'A', 'D', 'E', 'E'},
}, "SEE"},
ans79{true},
},
- question79{
+ {
para79{[][]byte{
- []byte{'A', 'B', 'C', 'E'},
- []byte{'S', 'F', 'C', 'S'},
- []byte{'A', 'D', 'E', 'E'},
+ {'A', 'B', 'C', 'E'},
+ {'S', 'F', 'C', 'S'},
+ {'A', 'D', 'E', 'E'},
}, "ABCB"},
ans79{false},
},
- question79{
+ {
para79{[][]byte{
- []byte{'o', 'a', 'a', 'n'},
- []byte{'e', 't', 'a', 'e'},
- []byte{'i', 'h', 'k', 'r'},
- []byte{'i', 'f', 'l', 'v'},
+ {'o', 'a', 'a', 'n'},
+ {'e', 't', 'a', 'e'},
+ {'i', 'h', 'k', 'r'},
+ {'i', 'f', 'l', 'v'},
}, "oath"},
ans79{true},
},
- question79{
+ {
para79{[][]byte{
- []byte{'o', 'a', 'a', 'n'},
- []byte{'e', 't', 'a', 'e'},
- []byte{'i', 'h', 'k', 'r'},
- []byte{'i', 'f', 'l', 'v'},
+ {'o', 'a', 'a', 'n'},
+ {'e', 't', 'a', 'e'},
+ {'i', 'h', 'k', 'r'},
+ {'i', 'f', 'l', 'v'},
}, "pea"},
ans79{false},
},
- question79{
+ {
para79{[][]byte{
- []byte{'o', 'a', 'a', 'n'},
- []byte{'e', 't', 'a', 'e'},
- []byte{'i', 'h', 'k', 'r'},
- []byte{'i', 'f', 'l', 'v'},
+ {'o', 'a', 'a', 'n'},
+ {'e', 't', 'a', 'e'},
+ {'i', 'h', 'k', 'r'},
+ {'i', 'f', 'l', 'v'},
}, "eat"},
ans79{true},
},
- question79{
+ {
para79{[][]byte{
- []byte{'o', 'a', 'a', 'n'},
- []byte{'e', 't', 'a', 'e'},
- []byte{'i', 'h', 'k', 'r'},
- []byte{'i', 'f', 'l', 'v'},
+ {'o', 'a', 'a', 'n'},
+ {'e', 't', 'a', 'e'},
+ {'i', 'h', 'k', 'r'},
+ {'i', 'f', 'l', 'v'},
}, "rain"},
ans79{false},
},
diff --git a/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II.go b/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II.go
index 4b8227b0..ae6e64c5 100644
--- a/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II.go
+++ b/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II.go
@@ -4,9 +4,9 @@ func removeDuplicates80(nums []int) int {
if len(nums) == 0 {
return 0
}
- last, finder, startFinder := 0, 0, -1
+ last, finder := 0, 0
for last < len(nums)-1 {
- startFinder = -1
+ startFinder := -1
for nums[finder] == nums[last] {
if startFinder == -1 || startFinder > finder {
startFinder = finder
diff --git a/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II_test.go b/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II_test.go
index 3e2e2dce..f64d4c86 100644
--- a/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II_test.go
+++ b/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II/80. Remove Duplicates from Sorted Array II_test.go
@@ -26,32 +26,32 @@ func Test_Problem80(t *testing.T) {
qs := []question80{
- question80{
+ {
para80{[]int{1, 1, 2}},
ans80{3},
},
- question80{
+ {
para80{[]int{0, 0, 1, 1, 1, 1, 2, 3, 4, 4}},
ans80{8},
},
- question80{
+ {
para80{[]int{0, 0, 0, 0, 0}},
ans80{2},
},
- question80{
+ {
para80{[]int{1}},
ans80{1},
},
- question80{
+ {
para80{[]int{0, 0, 1, 1, 1, 1, 2, 3, 3}},
ans80{7},
},
- question80{
+ {
para80{[]int{1, 1, 1, 1, 2, 2, 3}},
ans80{5},
},
diff --git a/leetcode/0081.Search-in-Rotated-Sorted-Array-II/81. Search in Rotated Sorted Array II_test.go b/leetcode/0081.Search-in-Rotated-Sorted-Array-II/81. Search in Rotated Sorted Array II_test.go
index 9e90576e..ba089f42 100644
--- a/leetcode/0081.Search-in-Rotated-Sorted-Array-II/81. Search in Rotated Sorted Array II_test.go
+++ b/leetcode/0081.Search-in-Rotated-Sorted-Array-II/81. Search in Rotated Sorted Array II_test.go
@@ -27,12 +27,12 @@ func Test_Problem81(t *testing.T) {
qs := []question81{
- question81{
+ {
para81{[]int{2, 5, 6, 0, 0, 1, 2}, 0},
ans81{true},
},
- question81{
+ {
para81{[]int{2, 5, 6, 0, 0, 1, 2}, 3},
ans81{false},
},
diff --git a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II_test.go b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II_test.go
index b9631bde..5bfd3ec2 100644
--- a/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II_test.go
+++ b/leetcode/0082.Remove-Duplicates-from-Sorted-List-II/82. Remove Duplicates from Sorted List II_test.go
@@ -28,47 +28,47 @@ func Test_Problem82(t *testing.T) {
qs := []question82{
- question82{
+ {
para82{[]int{1, 1, 2, 2, 3, 4, 4, 4}},
ans82{[]int{3}},
},
- question82{
+ {
para82{[]int{1, 1, 1, 1, 1, 1}},
ans82{[]int{}},
},
- question82{
+ {
para82{[]int{1, 1, 1, 2, 3}},
ans82{[]int{2, 3}},
},
- question82{
+ {
para82{[]int{1}},
ans82{[]int{1}},
},
- question82{
+ {
para82{[]int{}},
ans82{[]int{}},
},
- question82{
+ {
para82{[]int{1, 2, 2, 2, 2}},
ans82{[]int{1}},
},
- question82{
+ {
para82{[]int{1, 1, 2, 3, 3, 4, 5, 5, 6}},
ans82{[]int{2, 4, 6}},
},
- question82{
+ {
para82{[]int{1, 1, 2, 3, 3, 4, 5, 6}},
ans82{[]int{2, 4, 5, 6}},
},
- question82{
+ {
para82{[]int{0, 1, 2, 2, 3, 4}},
ans82{[]int{0, 1, 2, 2, 3, 4}},
},
diff --git a/leetcode/0083.Remove-Duplicates-from-Sorted-List/83. Remove Duplicates from Sorted List_test.go b/leetcode/0083.Remove-Duplicates-from-Sorted-List/83. Remove Duplicates from Sorted List_test.go
index 4d1e9fd9..2feb9fee 100644
--- a/leetcode/0083.Remove-Duplicates-from-Sorted-List/83. Remove Duplicates from Sorted List_test.go
+++ b/leetcode/0083.Remove-Duplicates-from-Sorted-List/83. Remove Duplicates from Sorted List_test.go
@@ -28,17 +28,17 @@ func Test_Problem83(t *testing.T) {
qs := []question83{
- question83{
+ {
para83{[]int{1, 1, 2}},
ans83{[]int{1, 2}},
},
- question83{
+ {
para83{[]int{1, 1, 2, 2, 3, 3, 3}},
ans83{[]int{1, 2, 3}},
},
- question83{
+ {
para83{[]int{1, 1, 1, 1, 1, 1, 1, 1}},
ans83{[]int{1}},
},
diff --git a/leetcode/0084.Largest-Rectangle-in-Histogram/84. Largest Rectangle in Histogram_test.go b/leetcode/0084.Largest-Rectangle-in-Histogram/84. Largest Rectangle in Histogram_test.go
index 65f0621e..7226916a 100644
--- a/leetcode/0084.Largest-Rectangle-in-Histogram/84. Largest Rectangle in Histogram_test.go
+++ b/leetcode/0084.Largest-Rectangle-in-Histogram/84. Largest Rectangle in Histogram_test.go
@@ -26,17 +26,17 @@ func Test_Problem84(t *testing.T) {
qs := []question84{
- question84{
+ {
para84{[]int{2, 1, 5, 6, 2, 3}},
ans84{10},
},
- question84{
+ {
para84{[]int{1}},
ans84{1},
},
- question84{
+ {
para84{[]int{1, 1}},
ans84{2},
},
diff --git a/leetcode/0086.Partition-List/86. Partition List_test.go b/leetcode/0086.Partition-List/86. Partition List_test.go
index 2ea1d618..4fd4e5f7 100644
--- a/leetcode/0086.Partition-List/86. Partition List_test.go
+++ b/leetcode/0086.Partition-List/86. Partition List_test.go
@@ -29,37 +29,37 @@ func Test_Problem86(t *testing.T) {
qs := []question86{
- question86{
+ {
para86{[]int{1, 4, 3, 2, 5, 2}, 3},
ans86{[]int{1, 2, 2, 4, 3, 5}},
},
- question86{
+ {
para86{[]int{1, 1, 2, 2, 3, 3, 3}, 2},
ans86{[]int{1, 1, 2, 2, 3, 3, 3}},
},
- question86{
+ {
para86{[]int{1, 4, 3, 2, 5, 2}, 0},
ans86{[]int{1, 4, 3, 2, 5, 2}},
},
- question86{
+ {
para86{[]int{4, 3, 2, 5, 2}, 3},
ans86{[]int{2, 2, 4, 3, 5}},
},
- question86{
+ {
para86{[]int{1, 1, 1, 1, 1, 1}, 1},
ans86{[]int{1, 1, 1, 1, 1, 1}},
},
- question86{
+ {
para86{[]int{3, 1}, 2},
ans86{[]int{1, 3}},
},
- question86{
+ {
para86{[]int{1, 2}, 3},
ans86{[]int{1, 2}},
},
diff --git a/leetcode/0088.Merge-Sorted-Array/88. Merge Sorted Array_test.go b/leetcode/0088.Merge-Sorted-Array/88. Merge Sorted Array_test.go
index 3d078d12..c27ca41e 100644
--- a/leetcode/0088.Merge-Sorted-Array/88. Merge Sorted Array_test.go
+++ b/leetcode/0088.Merge-Sorted-Array/88. Merge Sorted Array_test.go
@@ -44,7 +44,7 @@ func Test_Problem88(t *testing.T) {
// ans{[]int{1, 2, 2, 3}},
// },
- question88{
+ {
para88{[]int{1, 2, 3, 0, 0, 0}, 3, []int{2, 5, 6}, 3},
ans88{[]int{1, 2, 2, 3, 5, 6}},
},
diff --git a/leetcode/0089.Gray-Code/89. Gray Code_test.go b/leetcode/0089.Gray-Code/89. Gray Code_test.go
index 80da647f..5d27d3dc 100644
--- a/leetcode/0089.Gray-Code/89. Gray Code_test.go
+++ b/leetcode/0089.Gray-Code/89. Gray Code_test.go
@@ -26,17 +26,17 @@ func Test_Problem89(t *testing.T) {
qs := []question89{
- question89{
+ {
para89{2},
ans89{[]int{0, 1, 3, 2}},
},
- question89{
+ {
para89{0},
ans89{[]int{0}},
},
- question89{
+ {
para89{3},
ans89{[]int{0, 1, 3, 2, 6, 7, 5, 4}},
},
diff --git a/leetcode/0090.Subsets-II/90. Subsets II_test.go b/leetcode/0090.Subsets-II/90. Subsets II_test.go
index 8a5c1b9b..6b099e76 100644
--- a/leetcode/0090.Subsets-II/90. Subsets II_test.go
+++ b/leetcode/0090.Subsets-II/90. Subsets II_test.go
@@ -26,14 +26,14 @@ func Test_Problem90(t *testing.T) {
qs := []question90{
- question90{
+ {
para90{[]int{}},
- ans90{[][]int{[]int{}}},
+ ans90{[][]int{{}}},
},
- question90{
+ {
para90{[]int{1, 2, 2}},
- ans90{[][]int{[]int{}, []int{1}, []int{2}, []int{1, 2}, []int{2, 2}, []int{1, 2, 2}}},
+ ans90{[][]int{{}, {1}, {2}, {1, 2}, {2, 2}, {1, 2, 2}}},
},
}
diff --git a/leetcode/0091.Decode-Ways/91. Decode Ways_test.go b/leetcode/0091.Decode-Ways/91. Decode Ways_test.go
index 584cfcb9..2e274069 100644
--- a/leetcode/0091.Decode-Ways/91. Decode Ways_test.go
+++ b/leetcode/0091.Decode-Ways/91. Decode Ways_test.go
@@ -26,12 +26,12 @@ func Test_Problem91(t *testing.T) {
qs := []question91{
- question91{
+ {
para91{"12"},
ans91{2},
},
- question91{
+ {
para91{"226"},
ans91{3},
},
diff --git a/leetcode/0092.Reverse-Linked-List-II/92. Reverse Linked List II_test.go b/leetcode/0092.Reverse-Linked-List-II/92. Reverse Linked List II_test.go
index 35171501..a209bb26 100644
--- a/leetcode/0092.Reverse-Linked-List-II/92. Reverse Linked List II_test.go
+++ b/leetcode/0092.Reverse-Linked-List-II/92. Reverse Linked List II_test.go
@@ -29,32 +29,32 @@ func Test_Problem92(t *testing.T) {
qs := []question92{
- question92{
+ {
para92{[]int{1, 2, 3, 4, 5}, 2, 4},
ans92{[]int{1, 4, 3, 2, 5}},
},
- question92{
+ {
para92{[]int{1, 2, 3, 4, 5}, 2, 2},
ans92{[]int{1, 2, 3, 4, 5}},
},
- question92{
+ {
para92{[]int{1, 2, 3, 4, 5}, 1, 5},
ans92{[]int{5, 4, 3, 2, 1}},
},
- question92{
+ {
para92{[]int{1, 2, 3, 4, 5, 6}, 3, 4},
ans92{[]int{1, 2, 4, 3, 5, 6}},
},
- question92{
+ {
para92{[]int{3, 5}, 1, 2},
ans92{[]int{5, 3}},
},
- question92{
+ {
para92{[]int{3}, 3, 5},
ans92{[]int{3}},
},
diff --git a/leetcode/0093.Restore-IP-Addresses/93. Restore IP Addresses_test.go b/leetcode/0093.Restore-IP-Addresses/93. Restore IP Addresses_test.go
index f528a746..143b9892 100644
--- a/leetcode/0093.Restore-IP-Addresses/93. Restore IP Addresses_test.go
+++ b/leetcode/0093.Restore-IP-Addresses/93. Restore IP Addresses_test.go
@@ -26,17 +26,17 @@ func Test_Problem93(t *testing.T) {
qs := []question93{
- question93{
+ {
para93{"25525511135"},
ans93{[]string{"255.255.11.135", "255.255.111.35"}},
},
- question93{
+ {
para93{"0000"},
ans93{[]string{"0.0.0.0"}},
},
- question93{
+ {
para93{"010010"},
ans93{[]string{"0.10.0.10", "0.100.1.0"}},
},
diff --git a/leetcode/0094.Binary-Tree-Inorder-Traversal/94. Binary Tree Inorder Traversal_test.go b/leetcode/0094.Binary-Tree-Inorder-Traversal/94. Binary Tree Inorder Traversal_test.go
index 8ad80cdd..cb71b729 100644
--- a/leetcode/0094.Binary-Tree-Inorder-Traversal/94. Binary Tree Inorder Traversal_test.go
+++ b/leetcode/0094.Binary-Tree-Inorder-Traversal/94. Binary Tree Inorder Traversal_test.go
@@ -28,17 +28,17 @@ func Test_Problem94(t *testing.T) {
qs := []question94{
- question94{
+ {
para94{[]int{}},
ans94{[]int{}},
},
- question94{
+ {
para94{[]int{1}},
ans94{[]int{1}},
},
- question94{
+ {
para94{[]int{1, structures.NULL, 2, 3}},
ans94{[]int{1, 2, 3}},
},
diff --git a/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II.go b/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II.go
index d61737dc..27f4cf17 100644
--- a/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II.go
+++ b/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II.go
@@ -29,10 +29,9 @@ func generateBSTree(start, end int) []*TreeNode {
tree = append(tree, nil)
return tree
}
- left, right := []*TreeNode{}, []*TreeNode{}
for i := start; i <= end; i++ {
- left = generateBSTree(start, i-1)
- right = generateBSTree(i+1, end)
+ left := generateBSTree(start, i-1)
+ right := generateBSTree(i+1, end)
for _, l := range left {
for _, r := range right {
root := &TreeNode{Val: i, Left: l, Right: r}
diff --git a/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II_test.go b/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II_test.go
index ab04688a..3cac732d 100644
--- a/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II_test.go
+++ b/leetcode/0095.Unique-Binary-Search-Trees-II/95. Unique Binary Search Trees II_test.go
@@ -28,19 +28,19 @@ func Test_Problem95(t *testing.T) {
qs := []question95{
- question95{
+ {
para95{1},
- ans95{[]*TreeNode{&TreeNode{Val: 1, Left: nil, Right: nil}}},
+ ans95{[]*TreeNode{{Val: 1, Left: nil, Right: nil}}},
},
- question95{
+ {
para95{3},
ans95{[]*TreeNode{
- &TreeNode{Val: 1, Left: nil, Right: &TreeNode{Val: 3, Left: &TreeNode{Val: 2, Left: nil, Right: nil}, Right: nil}},
- &TreeNode{Val: 1, Left: nil, Right: &TreeNode{Val: 2, Left: nil, Right: &TreeNode{Val: 3, Left: nil, Right: nil}}},
- &TreeNode{Val: 3, Left: &TreeNode{Val: 2, Left: &TreeNode{Val: 1, Left: nil, Right: nil}, Right: nil}, Right: nil},
- &TreeNode{Val: 3, Left: &TreeNode{Val: 1, Left: nil, Right: &TreeNode{Val: 2, Left: nil, Right: nil}}, Right: nil},
- &TreeNode{Val: 2, Left: &TreeNode{Val: 1, Left: nil, Right: nil}, Right: &TreeNode{Val: 3, Left: nil, Right: nil}},
+ {Val: 1, Left: nil, Right: &TreeNode{Val: 3, Left: &TreeNode{Val: 2, Left: nil, Right: nil}, Right: nil}},
+ {Val: 1, Left: nil, Right: &TreeNode{Val: 2, Left: nil, Right: &TreeNode{Val: 3, Left: nil, Right: nil}}},
+ {Val: 3, Left: &TreeNode{Val: 2, Left: &TreeNode{Val: 1, Left: nil, Right: nil}, Right: nil}, Right: nil},
+ {Val: 3, Left: &TreeNode{Val: 1, Left: nil, Right: &TreeNode{Val: 2, Left: nil, Right: nil}}, Right: nil},
+ {Val: 2, Left: &TreeNode{Val: 1, Left: nil, Right: nil}, Right: &TreeNode{Val: 3, Left: nil, Right: nil}},
}}},
}
diff --git a/leetcode/0096.Unique-Binary-Search-Trees/96. Unique Binary Search Trees_test.go b/leetcode/0096.Unique-Binary-Search-Trees/96. Unique Binary Search Trees_test.go
index e573c196..dcf36458 100644
--- a/leetcode/0096.Unique-Binary-Search-Trees/96. Unique Binary Search Trees_test.go
+++ b/leetcode/0096.Unique-Binary-Search-Trees/96. Unique Binary Search Trees_test.go
@@ -26,46 +26,46 @@ func Test_Problem96(t *testing.T) {
qs := []question96{
- question96{
+ {
para96{1},
ans96{1},
},
- question96{
+ {
para96{3},
ans96{5},
},
- question96{
+ {
para96{4},
ans96{14},
},
- question96{
+ {
para96{5},
ans96{42},
},
- question96{
+ {
para96{6},
ans96{132},
},
- question96{
+ {
para96{7},
ans96{429},
},
- question96{
+ {
para96{8},
ans96{1430},
},
- question96{
+ {
para96{9},
ans96{4862},
},
- question96{
+ {
para96{10},
ans96{16796},
},
diff --git a/leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree_test.go b/leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree_test.go
index 9f567af5..e9063d34 100644
--- a/leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree_test.go
+++ b/leetcode/0098.Validate-Binary-Search-Tree/98. Validate Binary Search Tree_test.go
@@ -28,22 +28,22 @@ func Test_Problem98(t *testing.T) {
qs := []question98{
- question98{
+ {
para98{[]int{10, 5, 15, structures.NULL, structures.NULL, 6, 20}},
ans98{false},
},
- question98{
+ {
para98{[]int{}},
ans98{true},
},
- question98{
+ {
para98{[]int{2, 1, 3}},
ans98{true},
},
- question98{
+ {
para98{[]int{5, 1, 4, structures.NULL, structures.NULL, 3, 6}},
ans98{false},
},
diff --git a/leetcode/0099.Recover-Binary-Search-Tree/99. Recover Binary Search Tree_test.go b/leetcode/0099.Recover-Binary-Search-Tree/99. Recover Binary Search Tree_test.go
index 1830affc..958c2341 100644
--- a/leetcode/0099.Recover-Binary-Search-Tree/99. Recover Binary Search Tree_test.go
+++ b/leetcode/0099.Recover-Binary-Search-Tree/99. Recover Binary Search Tree_test.go
@@ -28,12 +28,12 @@ func Test_Problem99(t *testing.T) {
qs := []question99{
- question99{
+ {
para99{[]int{1, 3, structures.NULL, structures.NULL, 2}},
ans99{[]int{3, 1, structures.NULL, structures.NULL, 2}},
},
- question99{
+ {
para99{[]int{3, 1, 4, structures.NULL, structures.NULL, 2}},
ans99{[]int{2, 1, 4, structures.NULL, structures.NULL, 3}},
},
diff --git a/leetcode/0100.Same-Tree/100. Same Tree_test.go b/leetcode/0100.Same-Tree/100. Same Tree_test.go
index 7e727a03..e448f830 100644
--- a/leetcode/0100.Same-Tree/100. Same Tree_test.go
+++ b/leetcode/0100.Same-Tree/100. Same Tree_test.go
@@ -29,32 +29,32 @@ func Test_Problem100(t *testing.T) {
qs := []question100{
- question100{
+ {
para100{[]int{}, []int{}},
ans100{true},
},
- question100{
+ {
para100{[]int{}, []int{1}},
ans100{false},
},
- question100{
+ {
para100{[]int{1}, []int{1}},
ans100{true},
},
- question100{
+ {
para100{[]int{1, 2, 3}, []int{1, 2, 3}},
ans100{true},
},
- question100{
+ {
para100{[]int{1, 2}, []int{1, structures.NULL, 2}},
ans100{false},
},
- question100{
+ {
para100{[]int{1, 2, 1}, []int{1, 1, 2}},
ans100{false},
},
diff --git a/leetcode/0101.Symmetric-Tree/101. Symmetric Tree_test.go b/leetcode/0101.Symmetric-Tree/101. Symmetric Tree_test.go
index db0c69e2..fbf8293f 100644
--- a/leetcode/0101.Symmetric-Tree/101. Symmetric Tree_test.go
+++ b/leetcode/0101.Symmetric-Tree/101. Symmetric Tree_test.go
@@ -28,37 +28,37 @@ func Test_Problem101(t *testing.T) {
qs := []question101{
- question101{
+ {
para101{[]int{3, 4, 4, 5, structures.NULL, structures.NULL, 5, 6, structures.NULL, structures.NULL, 6}},
ans101{true},
},
- question101{
+ {
para101{[]int{1, 2, 2, structures.NULL, 3, 3}},
ans101{true},
},
- question101{
+ {
para101{[]int{}},
ans101{true},
},
- question101{
+ {
para101{[]int{1}},
ans101{true},
},
- question101{
+ {
para101{[]int{1, 2, 3}},
ans101{false},
},
- question101{
+ {
para101{[]int{1, 2, 2, 3, 4, 4, 3}},
ans101{true},
},
- question101{
+ {
para101{[]int{1, 2, 2, structures.NULL, 3, structures.NULL, 3}},
ans101{false},
},
diff --git a/leetcode/0102.Binary-Tree-Level-Order-Traversal/102. Binary Tree Level Order Traversal_test.go b/leetcode/0102.Binary-Tree-Level-Order-Traversal/102. Binary Tree Level Order Traversal_test.go
index cca627c1..190db881 100644
--- a/leetcode/0102.Binary-Tree-Level-Order-Traversal/102. Binary Tree Level Order Traversal_test.go
+++ b/leetcode/0102.Binary-Tree-Level-Order-Traversal/102. Binary Tree Level Order Traversal_test.go
@@ -28,19 +28,19 @@ func Test_Problem102(t *testing.T) {
qs := []question102{
- question102{
+ {
para102{[]int{}},
ans102{[][]int{}},
},
- question102{
+ {
para102{[]int{1}},
- ans102{[][]int{[]int{1}}},
+ ans102{[][]int{{1}}},
},
- question102{
+ {
para102{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
- ans102{[][]int{[]int{3}, []int{9, 20}, []int{15, 7}}},
+ ans102{[][]int{{3}, {9, 20}, {15, 7}}},
},
}
diff --git a/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal_test.go b/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal_test.go
index 87cb1cb7..1b550698 100644
--- a/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal_test.go
+++ b/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal/103. Binary Tree Zigzag Level Order Traversal_test.go
@@ -28,24 +28,24 @@ func Test_Problem103(t *testing.T) {
qs := []question103{
- question103{
+ {
para103{[]int{}},
ans103{[][]int{}},
},
- question103{
+ {
para103{[]int{1}},
- ans103{[][]int{[]int{1}}},
+ ans103{[][]int{{1}}},
},
- question103{
+ {
para103{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
- ans103{[][]int{[]int{3}, []int{9, 20}, []int{15, 7}}},
+ ans103{[][]int{{3}, {9, 20}, {15, 7}}},
},
- question103{
+ {
para103{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
- ans103{[][]int{[]int{1}, []int{3, 2}, []int{4, 5}}},
+ ans103{[][]int{{1}, {3, 2}, {4, 5}}},
},
}
diff --git a/leetcode/0104.Maximum-Depth-of-Binary-Tree/104. Maximum Depth of Binary Tree_test.go b/leetcode/0104.Maximum-Depth-of-Binary-Tree/104. Maximum Depth of Binary Tree_test.go
index 2c4380c8..a3ef5e1e 100644
--- a/leetcode/0104.Maximum-Depth-of-Binary-Tree/104. Maximum Depth of Binary Tree_test.go
+++ b/leetcode/0104.Maximum-Depth-of-Binary-Tree/104. Maximum Depth of Binary Tree_test.go
@@ -28,12 +28,12 @@ func Test_Problem104(t *testing.T) {
qs := []question104{
- question104{
+ {
para104{[]int{}},
ans104{0},
},
- question104{
+ {
para104{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans104{3},
},
diff --git a/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal/105. Construct Binary Tree from Preorder and Inorder Traversal_test.go b/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal/105. Construct Binary Tree from Preorder and Inorder Traversal_test.go
index b68fb74e..1bef0017 100644
--- a/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal/105. Construct Binary Tree from Preorder and Inorder Traversal_test.go
+++ b/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal/105. Construct Binary Tree from Preorder and Inorder Traversal_test.go
@@ -29,7 +29,7 @@ func Test_Problem105(t *testing.T) {
qs := []question105{
- question105{
+ {
para105{[]int{3, 9, 20, 15, 7}, []int{9, 3, 15, 20, 7}},
ans105{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
},
diff --git a/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/106. Construct Binary Tree from Inorder and Postorder Traversal_test.go b/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/106. Construct Binary Tree from Inorder and Postorder Traversal_test.go
index 0ff0ca69..eaa86c37 100644
--- a/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/106. Construct Binary Tree from Inorder and Postorder Traversal_test.go
+++ b/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/106. Construct Binary Tree from Inorder and Postorder Traversal_test.go
@@ -29,7 +29,7 @@ func Test_Problem106(t *testing.T) {
qs := []question106{
- question106{
+ {
para106{[]int{9, 3, 15, 20, 7}, []int{9, 15, 7, 20, 3}},
ans106{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
},
diff --git a/leetcode/0107.Binary-Tree-Level-Order-Traversal-II/107. Binary Tree Level Order Traversal II_test.go b/leetcode/0107.Binary-Tree-Level-Order-Traversal-II/107. Binary Tree Level Order Traversal II_test.go
index b167f65c..8978135d 100644
--- a/leetcode/0107.Binary-Tree-Level-Order-Traversal-II/107. Binary Tree Level Order Traversal II_test.go
+++ b/leetcode/0107.Binary-Tree-Level-Order-Traversal-II/107. Binary Tree Level Order Traversal II_test.go
@@ -28,19 +28,19 @@ func Test_Problem107(t *testing.T) {
qs := []question107{
- question107{
+ {
para107{[]int{}},
ans107{[][]int{}},
},
- question107{
+ {
para107{[]int{1}},
- ans107{[][]int{[]int{1}}},
+ ans107{[][]int{{1}}},
},
- question107{
+ {
para107{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
- ans107{[][]int{[]int{15, 7}, []int{9, 20}, []int{3}}},
+ ans107{[][]int{{15, 7}, {9, 20}, {3}}},
},
}
diff --git a/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree/108. Convert Sorted Array to Binary Search Tree_test.go b/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree/108. Convert Sorted Array to Binary Search Tree_test.go
index 0cfdd5a3..44f4ae41 100644
--- a/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree/108. Convert Sorted Array to Binary Search Tree_test.go
+++ b/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree/108. Convert Sorted Array to Binary Search Tree_test.go
@@ -28,7 +28,7 @@ func Test_Problem108(t *testing.T) {
qs := []question108{
- question108{
+ {
para108{[]int{-10, -3, 0, 5, 9}},
ans108{[]int{0, -3, 9, -10, structures.NULL, 5}},
},
diff --git a/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/109. Convert Sorted List to Binary Search Tree_test.go b/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/109. Convert Sorted List to Binary Search Tree_test.go
index 10c36287..06f7f323 100644
--- a/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/109. Convert Sorted List to Binary Search Tree_test.go
+++ b/leetcode/0109.Convert-Sorted-List-to-Binary-Search-Tree/109. Convert Sorted List to Binary Search Tree_test.go
@@ -28,22 +28,22 @@ func Test_Problem109(t *testing.T) {
qs := []question109{
- question109{
+ {
para109{[]int{-10, -3, 0, 5, 9}},
ans109{[]int{0, -10, 5, structures.NULL, -3, structures.NULL, 9}},
},
- question109{
+ {
para109{[]int{-10}},
ans109{[]int{-10}},
},
- question109{
+ {
para109{[]int{1, 2}},
ans109{[]int{1, 2}},
},
- question109{
+ {
para109{[]int{1, 2, 3}},
ans109{[]int{2, 1, 3}},
},
diff --git a/leetcode/0110.Balanced-Binary-Tree/110. Balanced Binary Tree_test.go b/leetcode/0110.Balanced-Binary-Tree/110. Balanced Binary Tree_test.go
index 785e6313..2868cfcc 100644
--- a/leetcode/0110.Balanced-Binary-Tree/110. Balanced Binary Tree_test.go
+++ b/leetcode/0110.Balanced-Binary-Tree/110. Balanced Binary Tree_test.go
@@ -28,37 +28,37 @@ func Test_Problem110(t *testing.T) {
qs := []question110{
- question110{
+ {
para110{[]int{3, 4, 4, 5, structures.NULL, structures.NULL, 5, 6, structures.NULL, structures.NULL, 6}},
ans110{false},
},
- question110{
+ {
para110{[]int{1, 2, 2, structures.NULL, 3, 3}},
ans110{true},
},
- question110{
+ {
para110{[]int{}},
ans110{true},
},
- question110{
+ {
para110{[]int{1}},
ans110{true},
},
- question110{
+ {
para110{[]int{1, 2, 3}},
ans110{true},
},
- question110{
+ {
para110{[]int{1, 2, 2, 3, 4, 4, 3}},
ans110{true},
},
- question110{
+ {
para110{[]int{1, 2, 2, structures.NULL, 3, structures.NULL, 3}},
ans110{true},
},
diff --git a/leetcode/0111.Minimum-Depth-of-Binary-Tree/111. Minimum Depth of Binary Tree_test.go b/leetcode/0111.Minimum-Depth-of-Binary-Tree/111. Minimum Depth of Binary Tree_test.go
index 8cd759e3..a2a3753d 100644
--- a/leetcode/0111.Minimum-Depth-of-Binary-Tree/111. Minimum Depth of Binary Tree_test.go
+++ b/leetcode/0111.Minimum-Depth-of-Binary-Tree/111. Minimum Depth of Binary Tree_test.go
@@ -28,22 +28,22 @@ func Test_Problem111(t *testing.T) {
qs := []question111{
- question111{
+ {
para111{[]int{}},
ans111{0},
},
- question111{
+ {
para111{[]int{1}},
ans111{1},
},
- question111{
+ {
para111{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans111{2},
},
- question111{
+ {
para111{[]int{1, 2}},
ans111{2},
},
diff --git a/leetcode/0112.Path-Sum/112. Path Sum_test.go b/leetcode/0112.Path-Sum/112. Path Sum_test.go
index 7d50ede9..70168357 100644
--- a/leetcode/0112.Path-Sum/112. Path Sum_test.go
+++ b/leetcode/0112.Path-Sum/112. Path Sum_test.go
@@ -29,12 +29,12 @@ func Test_Problem112(t *testing.T) {
qs := []question112{
- question112{
+ {
para112{[]int{}, 0},
ans112{false},
},
- question112{
+ {
para112{[]int{5, 4, 8, 11, structures.NULL, 13, 4, 7, 2, structures.NULL, structures.NULL, structures.NULL, 1}, 22},
ans112{true},
},
diff --git a/leetcode/0113.Path-Sum-II/113. Path Sum II.go b/leetcode/0113.Path-Sum-II/113. Path Sum II.go
index 0cb5c044..6bca79a4 100644
--- a/leetcode/0113.Path-Sum-II/113. Path Sum II.go
+++ b/leetcode/0113.Path-Sum-II/113. Path Sum II.go
@@ -45,7 +45,7 @@ func pathSum1(root *TreeNode, sum int) [][]int {
}
if root.Left == nil && root.Right == nil {
if sum == root.Val {
- return [][]int{[]int{root.Val}}
+ return [][]int{{root.Val}}
}
}
path, res := []int{}, [][]int{}
diff --git a/leetcode/0113.Path-Sum-II/113. Path Sum II_test.go b/leetcode/0113.Path-Sum-II/113. Path Sum II_test.go
index 6de18c28..e7520d11 100644
--- a/leetcode/0113.Path-Sum-II/113. Path Sum II_test.go
+++ b/leetcode/0113.Path-Sum-II/113. Path Sum II_test.go
@@ -28,19 +28,19 @@ type ans113 struct {
func Test_Problem113(t *testing.T) {
qs := []question113{
- question113{
+ {
para113{[]int{1, 0, 1, 1, 2, 0, -1, 0, 1, -1, 0, -1, 0, 1, 0}, 2},
- ans113{[][]int{[]int{1, 0, 1, 0}, []int{1, 0, 2, -1}, []int{1, 1, 0, 0}, []int{1, 1, -1, 1}}},
+ ans113{[][]int{{1, 0, 1, 0}, {1, 0, 2, -1}, {1, 1, 0, 0}, {1, 1, -1, 1}}},
},
- question113{
+ {
para113{[]int{}, 0},
- ans113{[][]int{[]int{}}},
+ ans113{[][]int{{}}},
},
- question113{
+ {
para113{[]int{5, 4, 8, 11, structures.NULL, 13, 4, 7, 2, structures.NULL, structures.NULL, 5, 1}, 22},
- ans113{[][]int{[]int{5, 4, 11, 2}, []int{5, 8, 4, 5}}},
+ ans113{[][]int{{5, 4, 11, 2}, {5, 8, 4, 5}}},
},
}
diff --git a/leetcode/0114.Flatten-Binary-Tree-to-Linked-List/114. Flatten Binary Tree to Linked List_test.go b/leetcode/0114.Flatten-Binary-Tree-to-Linked-List/114. Flatten Binary Tree to Linked List_test.go
index a05d4dbc..29909396 100644
--- a/leetcode/0114.Flatten-Binary-Tree-to-Linked-List/114. Flatten Binary Tree to Linked List_test.go
+++ b/leetcode/0114.Flatten-Binary-Tree-to-Linked-List/114. Flatten Binary Tree to Linked List_test.go
@@ -28,7 +28,7 @@ func Test_Problem114(t *testing.T) {
qs := []question114{
- question114{
+ {
para114{[]int{1, 2, 3, 4, 5, 6}},
ans114{[]int{1, 2, 3, 4, 5, 6}},
},
diff --git a/leetcode/0118.Pascals-Triangle/118. Pascal's Triangle_test.go b/leetcode/0118.Pascals-Triangle/118. Pascal's Triangle_test.go
index 9130cd61..5b8e87a7 100644
--- a/leetcode/0118.Pascals-Triangle/118. Pascal's Triangle_test.go
+++ b/leetcode/0118.Pascals-Triangle/118. Pascal's Triangle_test.go
@@ -26,17 +26,17 @@ func Test_Problem118(t *testing.T) {
qs := []question118{
- question118{
+ {
para118{2},
ans118{[][]int{{1}, {1, 1}}},
},
- question118{
+ {
para118{5},
ans118{[][]int{{1}, {1, 1}, {1, 2, 1}, {1, 3, 3, 1}, {1, 4, 6, 4, 1}}},
},
- question118{
+ {
para118{10},
ans118{[][]int{{1}, {1, 1}, {1, 2, 1}, {1, 3, 3, 1}, {1, 4, 6, 4, 1}, {1, 5, 10, 10, 5, 1}, {1, 6, 15, 20, 15, 6, 1}, {1, 7, 21, 35, 35, 21, 7, 1}, {1, 8, 28, 56, 70, 56, 28, 8, 1}, {1, 9, 36, 84, 126, 126, 84, 36, 9, 1}}},
},
diff --git a/leetcode/0120.Triangle/120. Triangle_test.go b/leetcode/0120.Triangle/120. Triangle_test.go
index a7930103..2398cafe 100644
--- a/leetcode/0120.Triangle/120. Triangle_test.go
+++ b/leetcode/0120.Triangle/120. Triangle_test.go
@@ -25,8 +25,8 @@ type ans120 struct {
func Test_Problem120(t *testing.T) {
qs := []question120{
- question120{
- para120{[][]int{[]int{2}, []int{3, 4}, []int{6, 5, 7}, []int{4, 1, 8, 3}}},
+ {
+ para120{[][]int{{2}, {3, 4}, {6, 5, 7}, {4, 1, 8, 3}}},
ans120{11},
},
}
diff --git a/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock/121. Best Time to Buy and Sell Stock_test.go b/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock/121. Best Time to Buy and Sell Stock_test.go
index 10e031e0..681161ed 100644
--- a/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock/121. Best Time to Buy and Sell Stock_test.go
+++ b/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock/121. Best Time to Buy and Sell Stock_test.go
@@ -26,22 +26,22 @@ func Test_Problem121(t *testing.T) {
qs := []question121{
- question121{
+ {
para121{[]int{}},
ans121{0},
},
- question121{
+ {
para121{[]int{7, 1, 5, 3, 6, 4}},
ans121{5},
},
- question121{
+ {
para121{[]int{7, 6, 4, 3, 1}},
ans121{0},
},
- question121{
+ {
para121{[]int{1, 3, 2, 8, 4, 9}},
ans121{8},
},
diff --git a/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II/122. Best Time to Buy and Sell Stock II_test.go b/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II/122. Best Time to Buy and Sell Stock II_test.go
index 009f44c4..dd58050f 100644
--- a/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II/122. Best Time to Buy and Sell Stock II_test.go
+++ b/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II/122. Best Time to Buy and Sell Stock II_test.go
@@ -26,27 +26,27 @@ func Test_Problem122(t *testing.T) {
qs := []question122{
- question122{
+ {
para122{[]int{}},
ans122{0},
},
- question122{
+ {
para122{[]int{7, 1, 5, 3, 6, 4}},
ans122{7},
},
- question122{
+ {
para122{[]int{7, 6, 4, 3, 1}},
ans122{0},
},
- question122{
+ {
para122{[]int{1, 2, 3, 4, 5}},
ans122{4},
},
- question122{
+ {
para122{[]int{1, 2, 10, 11, 12, 15}},
ans122{14},
},
diff --git a/leetcode/0124.Binary-Tree-Maximum-Path-Sum/124. Binary Tree Maximum Path Sum_test.go b/leetcode/0124.Binary-Tree-Maximum-Path-Sum/124. Binary Tree Maximum Path Sum_test.go
index a32dafec..7e57778c 100644
--- a/leetcode/0124.Binary-Tree-Maximum-Path-Sum/124. Binary Tree Maximum Path Sum_test.go
+++ b/leetcode/0124.Binary-Tree-Maximum-Path-Sum/124. Binary Tree Maximum Path Sum_test.go
@@ -28,22 +28,22 @@ func Test_Problem124(t *testing.T) {
qs := []question124{
- question124{
+ {
para124{[]int{}},
ans124{0},
},
- question124{
+ {
para124{[]int{1}},
ans124{1},
},
- question124{
+ {
para124{[]int{1, 2, 3}},
ans124{6},
},
- question124{
+ {
para124{[]int{-10, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans124{42},
},
diff --git a/leetcode/0126.Word-Ladder-II/126. Word Ladder II_test.go b/leetcode/0126.Word-Ladder-II/126. Word Ladder II_test.go
index 9745cabc..7859a7b3 100644
--- a/leetcode/0126.Word-Ladder-II/126. Word Ladder II_test.go
+++ b/leetcode/0126.Word-Ladder-II/126. Word Ladder II_test.go
@@ -27,12 +27,12 @@ type ans126 struct {
func Test_Problem126(t *testing.T) {
qs := []question126{
- question126{
+ {
para126{"hit", "cog", []string{"hot", "dot", "dog", "lot", "log", "cog"}},
- ans126{[][]string{[]string{"hit", "hot", "dot", "dog", "cog"}, []string{"hit", "hot", "lot", "log", "cog"}}},
+ ans126{[][]string{{"hit", "hot", "dot", "dog", "cog"}, {"hit", "hot", "lot", "log", "cog"}}},
},
- question126{
+ {
para126{"hit", "cog", []string{"hot", "dot", "dog", "lot", "log"}},
ans126{[][]string{}},
},
diff --git a/leetcode/0127.Word-Ladder/127. Word Ladder_test.go b/leetcode/0127.Word-Ladder/127. Word Ladder_test.go
index 59591fe0..64c5f13f 100644
--- a/leetcode/0127.Word-Ladder/127. Word Ladder_test.go
+++ b/leetcode/0127.Word-Ladder/127. Word Ladder_test.go
@@ -27,12 +27,12 @@ type ans127 struct {
func Test_Problem127(t *testing.T) {
qs := []question127{
- question127{
+ {
para127{"hit", "cog", []string{"hot", "dot", "dog", "lot", "log", "cog"}},
ans127{5},
},
- question127{
+ {
para127{"hit", "cog", []string{"hot", "dot", "dog", "lot", "log"}},
ans127{0},
},
diff --git a/leetcode/0128.Longest-Consecutive-Sequence/128. Longest Consecutive Sequence_test.go b/leetcode/0128.Longest-Consecutive-Sequence/128. Longest Consecutive Sequence_test.go
index 0b769241..1e2ee31d 100644
--- a/leetcode/0128.Longest-Consecutive-Sequence/128. Longest Consecutive Sequence_test.go
+++ b/leetcode/0128.Longest-Consecutive-Sequence/128. Longest Consecutive Sequence_test.go
@@ -26,27 +26,27 @@ func Test_Problem128(t *testing.T) {
qs := []question128{
- question128{
+ {
para128{[]int{}},
ans128{0},
},
- question128{
+ {
para128{[]int{0}},
ans128{1},
},
- question128{
+ {
para128{[]int{9, 1, 4, 7, 3, -1, 0, 5, 8, -1, 6}},
ans128{7},
},
- question128{
+ {
para128{[]int{2147483646, -2147483647, 0, 2, 2147483644, -2147483645, 2147483645}},
ans128{3},
},
- question128{
+ {
para128{[]int{100, 4, 200, 1, 3, 2}},
ans128{4},
},
diff --git a/leetcode/0129.Sum-Root-to-Leaf-Numbers/129. Sum Root to Leaf Numbers_test.go b/leetcode/0129.Sum-Root-to-Leaf-Numbers/129. Sum Root to Leaf Numbers_test.go
index b1cd76d4..0b50a662 100644
--- a/leetcode/0129.Sum-Root-to-Leaf-Numbers/129. Sum Root to Leaf Numbers_test.go
+++ b/leetcode/0129.Sum-Root-to-Leaf-Numbers/129. Sum Root to Leaf Numbers_test.go
@@ -28,17 +28,17 @@ func Test_Problem129(t *testing.T) {
qs := []question129{
- question129{
+ {
para129{[]int{}},
ans129{0},
},
- question129{
+ {
para129{[]int{1, 2, 3}},
ans129{25},
},
- question129{
+ {
para129{[]int{4, 9, 0, 5, 1}},
ans129{1026},
},
diff --git a/leetcode/0130.Surrounded-Regions/130. Surrounded Regions.go b/leetcode/0130.Surrounded-Regions/130. Surrounded Regions.go
index e7a4628f..9d904e36 100644
--- a/leetcode/0130.Surrounded-Regions/130. Surrounded Regions.go
+++ b/leetcode/0130.Surrounded-Regions/130. Surrounded Regions.go
@@ -5,10 +5,10 @@ import (
)
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
// 解法一 并查集
diff --git a/leetcode/0130.Surrounded-Regions/130. Surrounded Regions_test.go b/leetcode/0130.Surrounded-Regions/130. Surrounded Regions_test.go
index a363b5f0..1dec2ced 100644
--- a/leetcode/0130.Surrounded-Regions/130. Surrounded Regions_test.go
+++ b/leetcode/0130.Surrounded-Regions/130. Surrounded Regions_test.go
@@ -26,14 +26,14 @@ func Test_Problem130(t *testing.T) {
qs := []question130{
- question130{
+ {
para130{[][]byte{}},
ans130{[][]byte{}},
},
- question130{
- para130{[][]byte{[]byte{'X', 'X', 'X', 'X'}, []byte{'X', 'O', 'O', 'X'}, []byte{'X', 'X', 'O', 'X'}, []byte{'X', 'O', 'X', 'X'}}},
- ans130{[][]byte{[]byte{'X', 'X', 'X', 'X'}, []byte{'X', 'X', 'X', 'X'}, []byte{'X', 'X', 'X', 'X'}, []byte{'X', 'O', 'X', 'X'}}},
+ {
+ para130{[][]byte{{'X', 'X', 'X', 'X'}, {'X', 'O', 'O', 'X'}, {'X', 'X', 'O', 'X'}, {'X', 'O', 'X', 'X'}}},
+ ans130{[][]byte{{'X', 'X', 'X', 'X'}, {'X', 'X', 'X', 'X'}, {'X', 'X', 'X', 'X'}, {'X', 'O', 'X', 'X'}}},
},
}
diff --git a/leetcode/0131.Palindrome-Partitioning/131. Palindrome Partitioning_test.go b/leetcode/0131.Palindrome-Partitioning/131. Palindrome Partitioning_test.go
index d482ce22..7008f7e2 100644
--- a/leetcode/0131.Palindrome-Partitioning/131. Palindrome Partitioning_test.go
+++ b/leetcode/0131.Palindrome-Partitioning/131. Palindrome Partitioning_test.go
@@ -26,24 +26,24 @@ func Test_Problem131(t *testing.T) {
qs := []question131{
- question131{
+ {
para131{"aab"},
- ans131{[][]string{[]string{"aa", "b"}, []string{"a", "a", "b"}}},
+ ans131{[][]string{{"aa", "b"}, {"a", "a", "b"}}},
},
- question131{
+ {
para131{"bb"},
- ans131{[][]string{[]string{"b", "b"}, []string{"bb"}}},
+ ans131{[][]string{{"b", "b"}, {"bb"}}},
},
- question131{
+ {
para131{"efe"},
- ans131{[][]string{[]string{"e", "f", "e"}, []string{"efe"}}},
+ ans131{[][]string{{"e", "f", "e"}, {"efe"}}},
},
- question131{
+ {
para131{"abbab"},
- ans131{[][]string{[]string{"a", "b", "b", "a", "b"}, []string{"a", "b", "bab"}, []string{"a", "bb", "a", "b"}, []string{"abba", "b"}}},
+ ans131{[][]string{{"a", "b", "b", "a", "b"}, {"a", "b", "bab"}, {"a", "bb", "a", "b"}, {"abba", "b"}}},
},
}
diff --git a/leetcode/0136.Single-Number/136. Single Number_test.go b/leetcode/0136.Single-Number/136. Single Number_test.go
index fb2be390..2360a740 100644
--- a/leetcode/0136.Single-Number/136. Single Number_test.go
+++ b/leetcode/0136.Single-Number/136. Single Number_test.go
@@ -26,12 +26,12 @@ func Test_Problem136(t *testing.T) {
qs := []question136{
- question136{
+ {
para136{[]int{2, 2, 1}},
ans136{1},
},
- question136{
+ {
para136{[]int{4, 1, 2, 1, 2}},
ans136{4},
},
diff --git a/leetcode/0137.Single-Number-II/137. Single Number II_test.go b/leetcode/0137.Single-Number-II/137. Single Number II_test.go
index f637f0bb..55c61803 100644
--- a/leetcode/0137.Single-Number-II/137. Single Number II_test.go
+++ b/leetcode/0137.Single-Number-II/137. Single Number II_test.go
@@ -26,12 +26,12 @@ func Test_Problem137(t *testing.T) {
qs := []question137{
- question137{
+ {
para137{[]int{2, 2, 3, 2}},
ans137{3},
},
- question137{
+ {
para137{[]int{0, 1, 0, 1, 0, 1, 99}},
ans137{99},
},
diff --git a/leetcode/0143.Reorder-List/143. Reorder List_test.go b/leetcode/0143.Reorder-List/143. Reorder List_test.go
index 0e470c04..d8363de5 100644
--- a/leetcode/0143.Reorder-List/143. Reorder List_test.go
+++ b/leetcode/0143.Reorder-List/143. Reorder List_test.go
@@ -28,21 +28,21 @@ func Test_Problem143(t *testing.T) {
qs := []question143{
- question143{
+ {
para143{[]int{1, 2, 3, 4, 5}},
ans143{[]int{1, 5, 2, 4, 3}},
},
- question143{
+ {
para143{[]int{1, 2, 3, 4}},
ans143{[]int{1, 4, 2, 3}},
},
- question143{
+ {
para143{[]int{1}},
ans143{[]int{1}},
},
- question143{
+ {
para143{[]int{}},
ans143{[]int{}},
},
diff --git a/leetcode/0144.Binary-Tree-Preorder-Traversal/144. Binary Tree Preorder Traversal_test.go b/leetcode/0144.Binary-Tree-Preorder-Traversal/144. Binary Tree Preorder Traversal_test.go
index 965129a1..c66a5474 100644
--- a/leetcode/0144.Binary-Tree-Preorder-Traversal/144. Binary Tree Preorder Traversal_test.go
+++ b/leetcode/0144.Binary-Tree-Preorder-Traversal/144. Binary Tree Preorder Traversal_test.go
@@ -28,17 +28,17 @@ func Test_Problem144(t *testing.T) {
qs := []question144{
- question144{
+ {
para144{[]int{}},
ans144{[]int{}},
},
- question144{
+ {
para144{[]int{1}},
ans144{[]int{1}},
},
- question144{
+ {
para144{[]int{1, structures.NULL, 2, 3}},
ans144{[]int{1, 2, 3}},
},
diff --git a/leetcode/0145.Binary-Tree-Postorder-Traversal/145. Binary Tree Postorder Traversal_test.go b/leetcode/0145.Binary-Tree-Postorder-Traversal/145. Binary Tree Postorder Traversal_test.go
index f7896413..37a1ef3c 100644
--- a/leetcode/0145.Binary-Tree-Postorder-Traversal/145. Binary Tree Postorder Traversal_test.go
+++ b/leetcode/0145.Binary-Tree-Postorder-Traversal/145. Binary Tree Postorder Traversal_test.go
@@ -28,17 +28,17 @@ func Test_Problem145(t *testing.T) {
qs := []question145{
- question145{
+ {
para145{[]int{}},
ans145{[]int{}},
},
- question145{
+ {
para145{[]int{1}},
ans145{[]int{1}},
},
- question145{
+ {
para145{[]int{1, structures.NULL, 2, 3}},
ans145{[]int{1, 2, 3}},
},
diff --git a/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List.go b/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List.go
index 1b9f13ae..89ea6d7e 100644
--- a/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List.go
+++ b/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List.go
@@ -19,11 +19,9 @@ func insertionSortList(head *ListNode) *ListNode {
return head
}
newHead := &ListNode{Val: 0, Next: nil} // 这里初始化不要直接指向 head,为了下面循环可以统一处理
- cur := head
- pre := newHead
- next := &ListNode{Val: 0, Next: nil}
+ cur, pre := head, newHead
for cur != nil {
- next = cur.Next
+ next := cur.Next
for pre.Next != nil && pre.Next.Val < cur.Val {
pre = pre.Next
}
diff --git a/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List_test.go b/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List_test.go
index d619ae92..d1b0d395 100644
--- a/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List_test.go
+++ b/leetcode/0147.Insertion-Sort-List/147. Insertion Sort List_test.go
@@ -28,21 +28,21 @@ func Test_Problem147(t *testing.T) {
qs := []question147{
- question147{
+ {
para147{[]int{4, 2, 1, 3}},
ans147{[]int{1, 2, 3, 4}},
},
- question147{
+ {
para147{[]int{1}},
ans147{[]int{1}},
},
- question147{
+ {
para147{[]int{-1, 5, 3, 4, 0}},
ans147{[]int{-1, 0, 3, 4, 5}},
},
- question147{
+ {
para147{[]int{}},
ans147{[]int{}},
},
diff --git a/leetcode/0148.Sort-List/148. Sort List_test.go b/leetcode/0148.Sort-List/148. Sort List_test.go
index d255cde8..11258c23 100644
--- a/leetcode/0148.Sort-List/148. Sort List_test.go
+++ b/leetcode/0148.Sort-List/148. Sort List_test.go
@@ -28,21 +28,21 @@ func Test_Problem148(t *testing.T) {
qs := []question148{
- question148{
+ {
para148{[]int{1, 2, 3, 4, 5}},
ans148{[]int{1, 2, 3, 4, 5}},
},
- question148{
+ {
para148{[]int{1, 1, 2, 5, 5, 4, 10, 0}},
ans148{[]int{0, 1, 1, 2, 4, 5, 5}},
},
- question148{
+ {
para148{[]int{1}},
ans148{[]int{1}},
},
- question148{
+ {
para148{[]int{}},
ans148{[]int{}},
},
diff --git a/leetcode/0150.Evaluate-Reverse-Polish-Notation/150. Evaluate Reverse Polish Notation_test.go b/leetcode/0150.Evaluate-Reverse-Polish-Notation/150. Evaluate Reverse Polish Notation_test.go
index 13339ae2..55fb4476 100644
--- a/leetcode/0150.Evaluate-Reverse-Polish-Notation/150. Evaluate Reverse Polish Notation_test.go
+++ b/leetcode/0150.Evaluate-Reverse-Polish-Notation/150. Evaluate Reverse Polish Notation_test.go
@@ -26,21 +26,21 @@ func Test_Problem150(t *testing.T) {
qs := []question150{
- question150{
+ {
para150{[]string{"18"}},
ans150{18},
},
- question150{
+ {
para150{[]string{"2", "1", "+", "3", "*"}},
ans150{9},
},
- question150{
+ {
para150{[]string{"4", "13", "5", "/", "+"}},
ans150{6},
},
- question150{
+ {
para150{[]string{"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"}},
ans150{22},
},
diff --git a/leetcode/0151.Reverse-Words-in-a-String/151. Reverse Words in a String_test.go b/leetcode/0151.Reverse-Words-in-a-String/151. Reverse Words in a String_test.go
index aa5f48e0..195ac83d 100644
--- a/leetcode/0151.Reverse-Words-in-a-String/151. Reverse Words in a String_test.go
+++ b/leetcode/0151.Reverse-Words-in-a-String/151. Reverse Words in a String_test.go
@@ -26,16 +26,16 @@ func Test_Problem151(t *testing.T) {
qs := []question151{
- question151{
+ {
para151{"the sky is blue"},
ans151{"blue is sky the"},
},
- question151{
+ {
para151{" hello world! "},
ans151{"world! hello"},
},
- question151{
+ {
para151{"a good example"},
ans151{"example good a"},
},
diff --git a/leetcode/0152.Maximum-Product-Subarray/152. Maximum Product Subarray_test.go b/leetcode/0152.Maximum-Product-Subarray/152. Maximum Product Subarray_test.go
index e37728d7..12a77add 100644
--- a/leetcode/0152.Maximum-Product-Subarray/152. Maximum Product Subarray_test.go
+++ b/leetcode/0152.Maximum-Product-Subarray/152. Maximum Product Subarray_test.go
@@ -26,27 +26,27 @@ func Test_Problem152(t *testing.T) {
qs := []question152{
- question152{
+ {
para152{[]int{-2}},
ans152{-2},
},
- question152{
+ {
para152{[]int{3, -1, 4}},
ans152{4},
},
- question152{
+ {
para152{[]int{0}},
ans152{0},
},
- question152{
+ {
para152{[]int{2, 3, -2, 4}},
ans152{6},
},
- question152{
+ {
para152{[]int{-2, 0, -1}},
ans152{0},
},
diff --git a/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array/153. Find Minimum in Rotated Sorted Array_test.go b/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array/153. Find Minimum in Rotated Sorted Array_test.go
index 43d3cde8..b6dce5e4 100644
--- a/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array/153. Find Minimum in Rotated Sorted Array_test.go
+++ b/leetcode/0153.Find-Minimum-in-Rotated-Sorted-Array/153. Find Minimum in Rotated Sorted Array_test.go
@@ -26,42 +26,42 @@ func Test_Problem153(t *testing.T) {
qs := []question153{
- question153{
+ {
para153{[]int{5, 1, 2, 3, 4}},
ans153{1},
},
- question153{
+ {
para153{[]int{1}},
ans153{1},
},
- question153{
+ {
para153{[]int{1, 2}},
ans153{1},
},
- question153{
+ {
para153{[]int{2, 1}},
ans153{1},
},
- question153{
+ {
para153{[]int{2, 3, 1}},
ans153{1},
},
- question153{
+ {
para153{[]int{1, 2, 3}},
ans153{1},
},
- question153{
+ {
para153{[]int{3, 4, 5, 1, 2}},
ans153{1},
},
- question153{
+ {
para153{[]int{4, 5, 6, 7, 0, 1, 2}},
ans153{0},
},
diff --git a/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II/154. Find Minimum in Rotated Sorted Array II_test.go b/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II/154. Find Minimum in Rotated Sorted Array II_test.go
index 7cfada0e..8e329a8a 100644
--- a/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II/154. Find Minimum in Rotated Sorted Array II_test.go
+++ b/leetcode/0154.Find-Minimum-in-Rotated-Sorted-Array-II/154. Find Minimum in Rotated Sorted Array II_test.go
@@ -26,57 +26,57 @@ func Test_Problem154(t *testing.T) {
qs := []question154{
- question154{
+ {
para154{[]int{10, 2, 10, 10, 10, 10}},
ans154{2},
},
- question154{
+ {
para154{[]int{1, 1}},
ans154{1},
},
- question154{
+ {
para154{[]int{2, 2, 2, 0, 1}},
ans154{0},
},
- question154{
+ {
para154{[]int{5, 1, 2, 3, 4}},
ans154{1},
},
- question154{
+ {
para154{[]int{1}},
ans154{1},
},
- question154{
+ {
para154{[]int{1, 2}},
ans154{1},
},
- question154{
+ {
para154{[]int{2, 1}},
ans154{1},
},
- question154{
+ {
para154{[]int{2, 3, 1}},
ans154{1},
},
- question154{
+ {
para154{[]int{1, 2, 3}},
ans154{1},
},
- question154{
+ {
para154{[]int{3, 4, 5, 1, 2}},
ans154{1},
},
- question154{
+ {
para154{[]int{4, 5, 6, 7, 0, 1, 2}},
ans154{0},
},
diff --git a/leetcode/0160.Intersection-of-Two-Linked-Lists/160. Intersection of Two Linked Lists_test.go b/leetcode/0160.Intersection-of-Two-Linked-Lists/160. Intersection of Two Linked Lists_test.go
index e24c710c..cc78f05a 100644
--- a/leetcode/0160.Intersection-of-Two-Linked-Lists/160. Intersection of Two Linked Lists_test.go
+++ b/leetcode/0160.Intersection-of-Two-Linked-Lists/160. Intersection of Two Linked Lists_test.go
@@ -29,32 +29,32 @@ func Test_Problem160(t *testing.T) {
qs := []question160{
- question160{
+ {
para160{[]int{}, []int{}},
ans160{[]int{}},
},
- question160{
+ {
para160{[]int{3}, []int{1, 2, 3}},
ans160{[]int{3}},
},
- question160{
+ {
para160{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans160{[]int{1, 2, 3, 4}},
},
- question160{
+ {
para160{[]int{4, 1, 8, 4, 5}, []int{5, 0, 1, 8, 4, 5}},
ans160{[]int{8, 4, 5}},
},
- question160{
+ {
para160{[]int{1}, []int{9, 9, 9, 9, 9}},
ans160{[]int{}},
},
- question160{
+ {
para160{[]int{0, 9, 1, 2, 4}, []int{3, 2, 4}},
ans160{[]int{2, 4}},
},
diff --git a/leetcode/0162.Find-Peak-Element/162. Find Peak Element_test.go b/leetcode/0162.Find-Peak-Element/162. Find Peak Element_test.go
index f5ef72bb..d446b33d 100644
--- a/leetcode/0162.Find-Peak-Element/162. Find Peak Element_test.go
+++ b/leetcode/0162.Find-Peak-Element/162. Find Peak Element_test.go
@@ -26,37 +26,37 @@ func Test_Problem162(t *testing.T) {
qs := []question162{
- question162{
+ {
para162{[]int{2, 1, 2}},
ans162{0},
},
- question162{
+ {
para162{[]int{3, 2, 1}},
ans162{0},
},
- question162{
+ {
para162{[]int{1, 2}},
ans162{1},
},
- question162{
+ {
para162{[]int{2, 1}},
ans162{0},
},
- question162{
+ {
para162{[]int{1}},
ans162{0},
},
- question162{
+ {
para162{[]int{1, 2, 3, 1}},
ans162{2},
},
- question162{
+ {
para162{[]int{1, 2, 1, 3, 5, 6, 4}},
ans162{5},
},
diff --git a/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go b/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go
index cb203d87..6030dfe2 100644
--- a/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go
+++ b/leetcode/0164.Maximum-Gap/164. Maximum Gap_test.go
@@ -26,26 +26,26 @@ func Test_Problem164(t *testing.T) {
qs := []question164{
- question164{
+ {
para164{[]int{3, 6, 9, 1}},
ans164{3},
},
- question164{
+ {
para164{[]int{1}},
ans164{0},
},
- question164{
+ {
para164{[]int{}},
ans164{0},
},
- question164{
+ {
para164{[]int{2, 10}},
ans164{8},
},
- question164{
+ {
para164{[]int{2, 435, 214, 64321, 643, 7234, 7, 436523, 7856, 8}},
ans164{372202},
},
diff --git a/leetcode/0167.Two-Sum-II---Input-array-is-sorted/167. Two Sum II - Input array is sorted_test.go b/leetcode/0167.Two-Sum-II---Input-array-is-sorted/167. Two Sum II - Input array is sorted_test.go
index e7336806..c172641a 100644
--- a/leetcode/0167.Two-Sum-II---Input-array-is-sorted/167. Two Sum II - Input array is sorted_test.go
+++ b/leetcode/0167.Two-Sum-II---Input-array-is-sorted/167. Two Sum II - Input array is sorted_test.go
@@ -27,7 +27,7 @@ func Test_Problem167(t *testing.T) {
qs := []question167{
- question167{
+ {
para167{[]int{2, 7, 11, 15}, 9},
ans167{[]int{1, 2}},
},
diff --git a/leetcode/0168.Excel-Sheet-Column-Title/168. Excel Sheet Column Title_test.go b/leetcode/0168.Excel-Sheet-Column-Title/168. Excel Sheet Column Title_test.go
index 7b9ef119..b0a6b4d8 100644
--- a/leetcode/0168.Excel-Sheet-Column-Title/168. Excel Sheet Column Title_test.go
+++ b/leetcode/0168.Excel-Sheet-Column-Title/168. Excel Sheet Column Title_test.go
@@ -26,32 +26,32 @@ func Test_Problem168(t *testing.T) {
qs := []question168{
- question168{
+ {
para168{1},
ans168{"A"},
},
- question168{
+ {
para168{28},
ans168{"AB"},
},
- question168{
+ {
para168{701},
ans168{"ZY"},
},
- question168{
+ {
para168{10011},
ans168{"NUA"},
},
- question168{
+ {
para168{999},
ans168{"ALK"},
},
- question168{
+ {
para168{681},
ans168{"ZE"},
},
diff --git a/leetcode/0169.Majority-Element/169. Majority Element_test.go b/leetcode/0169.Majority-Element/169. Majority Element_test.go
index 08c9bb89..a6aa6dc4 100644
--- a/leetcode/0169.Majority-Element/169. Majority Element_test.go
+++ b/leetcode/0169.Majority-Element/169. Majority Element_test.go
@@ -26,22 +26,22 @@ func Test_Problem169(t *testing.T) {
qs := []question169{
- question169{
+ {
para169{[]int{2, 2, 1}},
ans169{2},
},
- question169{
+ {
para169{[]int{3, 2, 3}},
ans169{3},
},
- question169{
+ {
para169{[]int{2, 2, 1, 1, 1, 2, 2}},
ans169{2},
},
- question169{
+ {
para169{[]int{-2147483648}},
ans169{-2147483648},
},
diff --git a/leetcode/0171.Excel-Sheet-Column-Number/171. Excel Sheet Column Number_test.go b/leetcode/0171.Excel-Sheet-Column-Number/171. Excel Sheet Column Number_test.go
index 955b4701..1b75d1ad 100644
--- a/leetcode/0171.Excel-Sheet-Column-Number/171. Excel Sheet Column Number_test.go
+++ b/leetcode/0171.Excel-Sheet-Column-Number/171. Excel Sheet Column Number_test.go
@@ -26,22 +26,22 @@ func Test_Problem171(t *testing.T) {
qs := []question171{
- question171{
+ {
para171{"A"},
ans171{1},
},
- question171{
+ {
para171{"AB"},
ans171{28},
},
- question171{
+ {
para171{"ZY"},
ans171{701},
},
- question171{
+ {
para171{"ABC"},
ans171{731},
},
diff --git a/leetcode/0172.Factorial-Trailing-Zeroes/172. Factorial Trailing Zeroes_test.go b/leetcode/0172.Factorial-Trailing-Zeroes/172. Factorial Trailing Zeroes_test.go
index a51a3a18..c29815fc 100644
--- a/leetcode/0172.Factorial-Trailing-Zeroes/172. Factorial Trailing Zeroes_test.go
+++ b/leetcode/0172.Factorial-Trailing-Zeroes/172. Factorial Trailing Zeroes_test.go
@@ -26,12 +26,12 @@ func Test_Problem172(t *testing.T) {
qs := []question172{
- question172{
+ {
para172{3},
ans172{0},
},
- question172{
+ {
para172{5},
ans172{1},
},
diff --git a/leetcode/0174.Dungeon-Game/174. Dungeon Game_test.go b/leetcode/0174.Dungeon-Game/174. Dungeon Game_test.go
index baa06fcb..fb2515c6 100644
--- a/leetcode/0174.Dungeon-Game/174. Dungeon Game_test.go
+++ b/leetcode/0174.Dungeon-Game/174. Dungeon Game_test.go
@@ -26,23 +26,23 @@ func Test_Problem174(t *testing.T) {
qs := []question174{
- question174{
- para174{[][]int{[]int{2, 1}, []int{1, -1}}},
+ {
+ para174{[][]int{{2, 1}, {1, -1}}},
ans174{1},
},
- question174{
- para174{[][]int{[]int{-3, 5}}},
+ {
+ para174{[][]int{{-3, 5}}},
ans174{4},
},
- question174{
- para174{[][]int{[]int{100}}},
+ {
+ para174{[][]int{{100}}},
ans174{1},
},
- question174{
- para174{[][]int{[]int{-2, -3, 3}, []int{-5, -10, 1}, []int{10, 30, -5}}},
+ {
+ para174{[][]int{{-2, -3, 3}, {-5, -10, 1}, {10, 30, -5}}},
ans174{7},
},
}
diff --git a/leetcode/0179.Largest-Number/179. Largest Number_test.go b/leetcode/0179.Largest-Number/179. Largest Number_test.go
index 3b40b312..20d98c3d 100644
--- a/leetcode/0179.Largest-Number/179. Largest Number_test.go
+++ b/leetcode/0179.Largest-Number/179. Largest Number_test.go
@@ -26,46 +26,46 @@ func Test_Problem179(t *testing.T) {
qs := []question179{
- question179{
+ {
para179{[]int{3, 6, 9, 1}},
ans179{"9631"},
},
- question179{
+ {
para179{[]int{1}},
ans179{"1"},
},
- question179{
+ {
para179{[]int{}},
ans179{""},
},
- question179{
+ {
para179{[]int{2, 10}},
ans179{"210"},
},
- question179{
+ {
para179{[]int{3, 30, 34, 5, 9}},
ans179{"9534330"},
},
- question179{
+ {
para179{[]int{12, 128}},
ans179{"12812"},
},
- question179{
+ {
para179{[]int{12, 121}},
ans179{"12121"},
},
- question179{
+ {
para179{[]int{0, 0}},
ans179{"0"},
},
- question179{
+ {
para179{[]int{1440, 7548, 4240, 6616, 733, 4712, 883, 8, 9576}},
ans179{"9576888375487336616471242401440"},
},
diff --git a/leetcode/0187.Repeated-DNA-Sequences/187. Repeated DNA Sequences_test.go b/leetcode/0187.Repeated-DNA-Sequences/187. Repeated DNA Sequences_test.go
index 7d78d0e7..ae0e40c9 100644
--- a/leetcode/0187.Repeated-DNA-Sequences/187. Repeated DNA Sequences_test.go
+++ b/leetcode/0187.Repeated-DNA-Sequences/187. Repeated DNA Sequences_test.go
@@ -26,7 +26,7 @@ func Test_Problem187(t *testing.T) {
qs := []question187{
- question187{
+ {
para187{"AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"},
ans187{[]string{"AAAAACCCCC", "CCCCCAAAAA"}},
},
diff --git a/leetcode/0190.Reverse-Bits/190. Reverse Bits_test.go b/leetcode/0190.Reverse-Bits/190. Reverse Bits_test.go
index 637d65e7..20c677d6 100644
--- a/leetcode/0190.Reverse-Bits/190. Reverse Bits_test.go
+++ b/leetcode/0190.Reverse-Bits/190. Reverse Bits_test.go
@@ -26,12 +26,12 @@ func Test_Problem190(t *testing.T) {
qs := []question190{
- question190{
+ {
para190{43261596},
ans190{964176192},
},
- question190{
+ {
para190{4294967293},
ans190{3221225471},
},
diff --git a/leetcode/0191.Number-of-1-Bits/191. Number of 1 Bits_test.go b/leetcode/0191.Number-of-1-Bits/191. Number of 1 Bits_test.go
index be7ff715..f327977c 100644
--- a/leetcode/0191.Number-of-1-Bits/191. Number of 1 Bits_test.go
+++ b/leetcode/0191.Number-of-1-Bits/191. Number of 1 Bits_test.go
@@ -26,11 +26,11 @@ func Test_Problem191(t *testing.T) {
qs := []question191{
- question191{
+ {
para191{5},
ans191{1},
},
- question191{
+ {
para191{13},
ans191{2},
},
diff --git a/leetcode/0198.House-Robber/198. House Robber_test.go b/leetcode/0198.House-Robber/198. House Robber_test.go
index e2f9be99..95eb40ff 100644
--- a/leetcode/0198.House-Robber/198. House Robber_test.go
+++ b/leetcode/0198.House-Robber/198. House Robber_test.go
@@ -26,16 +26,16 @@ func Test_Problem198(t *testing.T) {
qs := []question198{
- question198{
+ {
para198{[]int{1, 2}},
ans198{2},
},
- question198{
+ {
para198{[]int{1, 2, 3, 1}},
ans198{4},
},
- question198{
+ {
para198{[]int{2, 7, 9, 3, 1}},
ans198{12},
},
diff --git a/leetcode/0199.Binary-Tree-Right-Side-View/199. Binary Tree Right Side View_test.go b/leetcode/0199.Binary-Tree-Right-Side-View/199. Binary Tree Right Side View_test.go
index 0f8b6e68..58265fef 100644
--- a/leetcode/0199.Binary-Tree-Right-Side-View/199. Binary Tree Right Side View_test.go
+++ b/leetcode/0199.Binary-Tree-Right-Side-View/199. Binary Tree Right Side View_test.go
@@ -28,22 +28,22 @@ func Test_Problem199(t *testing.T) {
qs := []question199{
- question199{
+ {
para199{[]int{}},
ans199{[]int{}},
},
- question199{
+ {
para199{[]int{1}},
ans199{[]int{1}},
},
- question199{
+ {
para199{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans199{[]int{3, 20, 7}},
},
- question199{
+ {
para199{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
ans199{[]int{1, 3, 5}},
},
diff --git a/leetcode/0200.Number-of-Islands/200. Number of Islands.go b/leetcode/0200.Number-of-Islands/200. Number of Islands.go
index dac864a5..79829e07 100644
--- a/leetcode/0200.Number-of-Islands/200. Number of Islands.go
+++ b/leetcode/0200.Number-of-Islands/200. Number of Islands.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func numIslands(grid [][]byte) int {
diff --git a/leetcode/0200.Number-of-Islands/200. Number of Islands_test.go b/leetcode/0200.Number-of-Islands/200. Number of Islands_test.go
index 3f7805d8..8c16ac76 100644
--- a/leetcode/0200.Number-of-Islands/200. Number of Islands_test.go
+++ b/leetcode/0200.Number-of-Islands/200. Number of Islands_test.go
@@ -26,22 +26,22 @@ func Test_Problem200(t *testing.T) {
qs := []question200{
- question200{
+ {
para200{[][]byte{
- []byte{'1', '1', '1', '1', '0'},
- []byte{'1', '1', '0', '1', '0'},
- []byte{'1', '1', '0', '0', '0'},
- []byte{'0', '0', '0', '0', '0'},
+ {'1', '1', '1', '1', '0'},
+ {'1', '1', '0', '1', '0'},
+ {'1', '1', '0', '0', '0'},
+ {'0', '0', '0', '0', '0'},
}},
ans200{1},
},
- question200{
+ {
para200{[][]byte{
- []byte{'1', '1', '0', '0', '0'},
- []byte{'1', '1', '0', '0', '0'},
- []byte{'0', '0', '1', '0', '0'},
- []byte{'0', '0', '0', '1', '1'},
+ {'1', '1', '0', '0', '0'},
+ {'1', '1', '0', '0', '0'},
+ {'0', '0', '1', '0', '0'},
+ {'0', '0', '0', '1', '1'},
}},
ans200{3},
},
diff --git a/leetcode/0201.Bitwise-AND-of-Numbers-Range/201. Bitwise AND of Numbers Range_test.go b/leetcode/0201.Bitwise-AND-of-Numbers-Range/201. Bitwise AND of Numbers Range_test.go
index d68684cd..047214a0 100644
--- a/leetcode/0201.Bitwise-AND-of-Numbers-Range/201. Bitwise AND of Numbers Range_test.go
+++ b/leetcode/0201.Bitwise-AND-of-Numbers-Range/201. Bitwise AND of Numbers Range_test.go
@@ -27,12 +27,12 @@ func Test_Problem201(t *testing.T) {
qs := []question201{
- question201{
+ {
para201{5, 7},
ans201{4},
},
- question201{
+ {
para201{0, 1},
ans201{0},
},
diff --git a/leetcode/0202.Happy-Number/202. Happy Number_test.go b/leetcode/0202.Happy-Number/202. Happy Number_test.go
index f4963e98..d8e4e7f9 100644
--- a/leetcode/0202.Happy-Number/202. Happy Number_test.go
+++ b/leetcode/0202.Happy-Number/202. Happy Number_test.go
@@ -26,12 +26,12 @@ func Test_Problem202(t *testing.T) {
qs := []question202{
- question202{
+ {
para202{202},
ans202{false},
},
- question202{
+ {
para202{19},
ans202{true},
},
diff --git a/leetcode/0203.Remove-Linked-List-Elements/203. Remove Linked List Elements_test.go b/leetcode/0203.Remove-Linked-List-Elements/203. Remove Linked List Elements_test.go
index fe020fb6..f673d276 100644
--- a/leetcode/0203.Remove-Linked-List-Elements/203. Remove Linked List Elements_test.go
+++ b/leetcode/0203.Remove-Linked-List-Elements/203. Remove Linked List Elements_test.go
@@ -29,42 +29,42 @@ func Test_Problem203(t *testing.T) {
qs := []question203{
- question203{
+ {
para203{[]int{1, 2, 3, 4, 5}, 1},
ans203{[]int{2, 3, 4, 5}},
},
- question203{
+ {
para203{[]int{1, 2, 3, 4, 5}, 2},
ans203{[]int{1, 3, 4, 5}},
},
- question203{
+ {
para203{[]int{1, 1, 1, 1, 1}, 1},
ans203{[]int{}},
},
- question203{
+ {
para203{[]int{1, 2, 3, 2, 3, 2, 3, 2}, 2},
ans203{[]int{1, 3, 3, 3}},
},
- question203{
+ {
para203{[]int{1, 2, 3, 4, 5}, 5},
ans203{[]int{1, 2, 3, 4}},
},
- question203{
+ {
para203{[]int{}, 5},
ans203{[]int{}},
},
- question203{
+ {
para203{[]int{1, 2, 3, 4, 5}, 10},
ans203{[]int{1, 2, 3, 4, 5}},
},
- question203{
+ {
para203{[]int{1}, 1},
ans203{[]int{}},
},
diff --git a/leetcode/0204.Count-Primes/204. Count Primes_test.go b/leetcode/0204.Count-Primes/204. Count Primes_test.go
index b5c2cc89..884e9db4 100644
--- a/leetcode/0204.Count-Primes/204. Count Primes_test.go
+++ b/leetcode/0204.Count-Primes/204. Count Primes_test.go
@@ -26,17 +26,17 @@ func Test_Problem204(t *testing.T) {
qs := []question204{
- question204{
+ {
para204{10},
ans204{4},
},
- question204{
+ {
para204{100},
ans204{25},
},
- question204{
+ {
para204{1000},
ans204{168},
},
diff --git a/leetcode/0205.Isomorphic-Strings/205. Isomorphic Strings_test.go b/leetcode/0205.Isomorphic-Strings/205. Isomorphic Strings_test.go
index a8913622..d18c1f43 100644
--- a/leetcode/0205.Isomorphic-Strings/205. Isomorphic Strings_test.go
+++ b/leetcode/0205.Isomorphic-Strings/205. Isomorphic Strings_test.go
@@ -27,22 +27,22 @@ func Test_Problem205(t *testing.T) {
qs := []question205{
- question205{
+ {
para205{"egg", "add"},
ans205{true},
},
- question205{
+ {
para205{"foo", "bar"},
ans205{false},
},
- question205{
+ {
para205{"paper", "title"},
ans205{true},
},
- question205{
+ {
para205{"", ""},
ans205{true},
},
diff --git a/leetcode/0206.Reverse-Linked-List/206. Reverse Linked List_test.go b/leetcode/0206.Reverse-Linked-List/206. Reverse Linked List_test.go
index 109406a7..08e78a46 100644
--- a/leetcode/0206.Reverse-Linked-List/206. Reverse Linked List_test.go
+++ b/leetcode/0206.Reverse-Linked-List/206. Reverse Linked List_test.go
@@ -28,7 +28,7 @@ func Test_Problem206(t *testing.T) {
qs := []question206{
- question206{
+ {
para206{[]int{1, 2, 3, 4, 5}},
ans206{[]int{5, 4, 3, 2, 1}},
},
diff --git a/leetcode/0207.Course-Schedule/207. Course Schedule_test.go b/leetcode/0207.Course-Schedule/207. Course Schedule_test.go
index e1d79a0c..0f5395dd 100644
--- a/leetcode/0207.Course-Schedule/207. Course Schedule_test.go
+++ b/leetcode/0207.Course-Schedule/207. Course Schedule_test.go
@@ -27,13 +27,13 @@ func Test_Problem207(t *testing.T) {
qs := []question207{
- question207{
- para207{2, [][]int{[]int{1, 0}}},
+ {
+ para207{2, [][]int{{1, 0}}},
ans207{true},
},
- question207{
- para207{2, [][]int{[]int{1, 0}, []int{0, 1}}},
+ {
+ para207{2, [][]int{{1, 0}, {0, 1}}},
ans207{false},
},
}
diff --git a/leetcode/0209.Minimum-Size-Subarray-Sum/209. Minimum Size Subarray Sum_test.go b/leetcode/0209.Minimum-Size-Subarray-Sum/209. Minimum Size Subarray Sum_test.go
index 0bc0537e..446b943d 100644
--- a/leetcode/0209.Minimum-Size-Subarray-Sum/209. Minimum Size Subarray Sum_test.go
+++ b/leetcode/0209.Minimum-Size-Subarray-Sum/209. Minimum Size Subarray Sum_test.go
@@ -27,7 +27,7 @@ func Test_Problem209(t *testing.T) {
qs := []question209{
- question209{
+ {
para209{7, []int{2, 3, 1, 2, 4, 3}},
ans209{2},
},
diff --git a/leetcode/0210.Course-Schedule-II/210. Course Schedule II_test.go b/leetcode/0210.Course-Schedule-II/210. Course Schedule II_test.go
index 6e75c853..871bfc6e 100644
--- a/leetcode/0210.Course-Schedule-II/210. Course Schedule II_test.go
+++ b/leetcode/0210.Course-Schedule-II/210. Course Schedule II_test.go
@@ -27,23 +27,23 @@ func Test_Problem210(t *testing.T) {
qs := []question210{
- question210{
- para210{2, [][]int{[]int{1, 0}}},
+ {
+ para210{2, [][]int{{1, 0}}},
ans210{[]int{0, 1}},
},
- question210{
- para210{2, [][]int{[]int{1, 0}, []int{0, 1}}},
+ {
+ para210{2, [][]int{{1, 0}, {0, 1}}},
ans210{[]int{0, 1, 2, 3}},
},
- question210{
- para210{4, [][]int{[]int{1, 0}, []int{2, 0}, []int{3, 1}, []int{3, 2}}},
+ {
+ para210{4, [][]int{{1, 0}, {2, 0}, {3, 1}, {3, 2}}},
ans210{[]int{0, 1, 2, 3}},
},
- question210{
- para210{3, [][]int{[]int{1, 0}, []int{1, 2}, []int{0, 1}}},
+ {
+ para210{3, [][]int{{1, 0}, {1, 2}, {0, 1}}},
ans210{[]int{}},
},
}
diff --git a/leetcode/0212.Word-Search-II/212. Word Search II.go b/leetcode/0212.Word-Search-II/212. Word Search II.go
index e8f1da01..bea7241a 100644
--- a/leetcode/0212.Word-Search-II/212. Word Search II.go
+++ b/leetcode/0212.Word-Search-II/212. Word Search II.go
@@ -12,10 +12,10 @@ func findWords(board [][]byte, words []string) []string {
// these is 79 solution
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func exist(board [][]byte, word string) bool {
diff --git a/leetcode/0212.Word-Search-II/212. Word Search II_test.go b/leetcode/0212.Word-Search-II/212. Word Search II_test.go
index 9bcf342b..36780401 100644
--- a/leetcode/0212.Word-Search-II/212. Word Search II_test.go
+++ b/leetcode/0212.Word-Search-II/212. Word Search II_test.go
@@ -27,21 +27,21 @@ func Test_Problem212(t *testing.T) {
qs := []question212{
- question212{
+ {
para212{[][]byte{
- []byte{'A', 'B', 'C', 'E'},
- []byte{'S', 'F', 'C', 'S'},
- []byte{'A', 'D', 'E', 'E'},
+ {'A', 'B', 'C', 'E'},
+ {'S', 'F', 'C', 'S'},
+ {'A', 'D', 'E', 'E'},
}, []string{"ABCCED", "SEE", "ABCB"}},
ans212{[]string{"ABCCED", "SEE"}},
},
- question212{
+ {
para212{[][]byte{
- []byte{'o', 'a', 'a', 'n'},
- []byte{'e', 't', 'a', 'e'},
- []byte{'i', 'h', 'k', 'r'},
- []byte{'i', 'f', 'l', 'v'},
+ {'o', 'a', 'a', 'n'},
+ {'e', 't', 'a', 'e'},
+ {'i', 'h', 'k', 'r'},
+ {'i', 'f', 'l', 'v'},
}, []string{"oath", "pea", "eat", "rain"}},
ans212{[]string{"oath", "eat"}},
},
diff --git a/leetcode/0213.House-Robber-II/213. House Robber II_test.go b/leetcode/0213.House-Robber-II/213. House Robber II_test.go
index c2faf927..9c09e9e4 100644
--- a/leetcode/0213.House-Robber-II/213. House Robber II_test.go
+++ b/leetcode/0213.House-Robber-II/213. House Robber II_test.go
@@ -26,16 +26,16 @@ func Test_Problem213(t *testing.T) {
qs := []question213{
- question213{
+ {
para213{[]int{0, 0}},
ans213{0},
},
- question213{
+ {
para213{[]int{2, 3, 2}},
ans213{3},
},
- question213{
+ {
para213{[]int{1, 2, 3, 1}},
ans213{4},
},
diff --git a/leetcode/0215.Kth-Largest-Element-in-an-Array/215. Kth Largest Element in an Array_test.go b/leetcode/0215.Kth-Largest-Element-in-an-Array/215. Kth Largest Element in an Array_test.go
index e66bb953..0eef94c4 100644
--- a/leetcode/0215.Kth-Largest-Element-in-an-Array/215. Kth Largest Element in an Array_test.go
+++ b/leetcode/0215.Kth-Largest-Element-in-an-Array/215. Kth Largest Element in an Array_test.go
@@ -27,27 +27,27 @@ func Test_Problem215(t *testing.T) {
qs := []question215{
- question215{
+ {
para215{[]int{3, 2, 1, 5, 6, 4}, 2},
ans215{5},
},
- question215{
+ {
para215{[]int{3, 2, 3, 1, 2, 4, 5, 5, 6}, 4},
ans215{4},
},
- question215{
+ {
para215{[]int{0, 0, 0, 0, 0}, 2},
ans215{0},
},
- question215{
+ {
para215{[]int{1}, 1},
ans215{1},
},
- question215{
+ {
para215{[]int{3, 2, 3, 1, 2, 4, 5, 5, 6, 7, 7, 8, 2, 3, 1, 1, 1, 10, 11, 5, 6, 2, 4, 7, 8, 5, 6}, 20},
ans215{2},
},
diff --git a/leetcode/0216.Combination-Sum-III/216. Combination Sum III_test.go b/leetcode/0216.Combination-Sum-III/216. Combination Sum III_test.go
index b5891597..c4bcaad6 100644
--- a/leetcode/0216.Combination-Sum-III/216. Combination Sum III_test.go
+++ b/leetcode/0216.Combination-Sum-III/216. Combination Sum III_test.go
@@ -27,13 +27,13 @@ func Test_Problem216(t *testing.T) {
qs := []question216{
- question216{
+ {
para216{3, 7},
- ans216{[][]int{[]int{1, 2, 4}}},
+ ans216{[][]int{{1, 2, 4}}},
},
- question216{
+ {
para216{3, 9},
- ans216{[][]int{[]int{1, 2, 6}, []int{1, 3, 5}, []int{2, 3, 4}}},
+ ans216{[][]int{{1, 2, 6}, {1, 3, 5}, {2, 3, 4}}},
},
}
diff --git a/leetcode/0217.Contains-Duplicate/217. Contains Duplicate_test.go b/leetcode/0217.Contains-Duplicate/217. Contains Duplicate_test.go
index 270d0041..32542d57 100644
--- a/leetcode/0217.Contains-Duplicate/217. Contains Duplicate_test.go
+++ b/leetcode/0217.Contains-Duplicate/217. Contains Duplicate_test.go
@@ -26,17 +26,17 @@ func Test_Problem217(t *testing.T) {
qs := []question217{
- question217{
+ {
para217{[]int{1, 2, 3, 1}},
ans217{true},
},
- question217{
+ {
para217{[]int{1, 2, 3, 4}},
ans217{false},
},
- question217{
+ {
para217{[]int{1, 1, 1, 3, 3, 4, 3, 2, 4, 2}},
ans217{true},
},
diff --git a/leetcode/0218.The-Skyline-Problem/218. The Skyline Problem_test.go b/leetcode/0218.The-Skyline-Problem/218. The Skyline Problem_test.go
index f51b3364..3c861287 100644
--- a/leetcode/0218.The-Skyline-Problem/218. The Skyline Problem_test.go
+++ b/leetcode/0218.The-Skyline-Problem/218. The Skyline Problem_test.go
@@ -26,9 +26,9 @@ func Test_Problem218(t *testing.T) {
qs := []question218{
- question218{
- para218{[][]int{[]int{2, 9, 10}, []int{3, 7, 15}, []int{5, 12, 12}, []int{15, 20, 10}, []int{19, 24, 8}}},
- ans218{[][]int{[]int{2, 10}, []int{3, 15}, []int{7, 12}, []int{12, 0}, []int{15, 10}, []int{20, 8}, []int{24, 0}}},
+ {
+ para218{[][]int{{2, 9, 10}, {3, 7, 15}, {5, 12, 12}, {15, 20, 10}, {19, 24, 8}}},
+ ans218{[][]int{{2, 10}, {3, 15}, {7, 12}, {12, 0}, {15, 10}, {20, 8}, {24, 0}}},
},
}
diff --git a/leetcode/0219.Contains-Duplicate-II/219. Contains Duplicate II_test.go b/leetcode/0219.Contains-Duplicate-II/219. Contains Duplicate II_test.go
index e666345b..39bb6a6c 100644
--- a/leetcode/0219.Contains-Duplicate-II/219. Contains Duplicate II_test.go
+++ b/leetcode/0219.Contains-Duplicate-II/219. Contains Duplicate II_test.go
@@ -27,17 +27,17 @@ func Test_Problem219(t *testing.T) {
qs := []question219{
- question219{
+ {
para219{[]int{1, 2, 3, 1}, 3},
ans219{true},
},
- question219{
+ {
para219{[]int{1, 0, 0, 1}, 1},
ans219{true},
},
- question219{
+ {
para219{[]int{1, 2, 3, 1, 2, 3}, 2},
ans219{false},
},
diff --git a/leetcode/0220.Contains-Duplicate-III/220. Contains Duplicate III_test.go b/leetcode/0220.Contains-Duplicate-III/220. Contains Duplicate III_test.go
index 18761e0d..c5ef7906 100644
--- a/leetcode/0220.Contains-Duplicate-III/220. Contains Duplicate III_test.go
+++ b/leetcode/0220.Contains-Duplicate-III/220. Contains Duplicate III_test.go
@@ -28,27 +28,27 @@ func Test_Problem220(t *testing.T) {
qs := []question220{
- question220{
+ {
para220{[]int{7, 1, 3}, 2, 3},
ans220{true},
},
- question220{
+ {
para220{[]int{-1, -1}, 1, -1},
ans220{false},
},
- question220{
+ {
para220{[]int{1, 2, 3, 1}, 3, 0},
ans220{true},
},
- question220{
+ {
para220{[]int{1, 0, 1, 1}, 1, 2},
ans220{true},
},
- question220{
+ {
para220{[]int{1, 5, 9, 1, 5, 9}, 2, 3},
ans220{false},
},
diff --git a/leetcode/0222.Count-Complete-Tree-Nodes/222. Count Complete Tree Nodes_test.go b/leetcode/0222.Count-Complete-Tree-Nodes/222. Count Complete Tree Nodes_test.go
index 54a3819f..2c7b8b8e 100644
--- a/leetcode/0222.Count-Complete-Tree-Nodes/222. Count Complete Tree Nodes_test.go
+++ b/leetcode/0222.Count-Complete-Tree-Nodes/222. Count Complete Tree Nodes_test.go
@@ -28,22 +28,22 @@ func Test_Problem222(t *testing.T) {
qs := []question222{
- question222{
+ {
para222{[]int{}},
ans222{0},
},
- question222{
+ {
para222{[]int{1}},
ans222{1},
},
- question222{
+ {
para222{[]int{1, 2, 3}},
ans222{3},
},
- question222{
+ {
para222{[]int{1, 2, 3, 4, 5, 6}},
ans222{6},
},
diff --git a/leetcode/0223.Rectangle-Area/223. Rectangle Area_test.go b/leetcode/0223.Rectangle-Area/223. Rectangle Area_test.go
index c7f8c7b9..5b092d78 100644
--- a/leetcode/0223.Rectangle-Area/223. Rectangle Area_test.go
+++ b/leetcode/0223.Rectangle-Area/223. Rectangle Area_test.go
@@ -33,7 +33,7 @@ func Test_Problem223(t *testing.T) {
qs := []question223{
- question223{
+ {
para223{-3, 0, 3, 4, 0, -1, 9, 2},
ans223{45},
},
diff --git a/leetcode/0224.Basic-Calculator/224. Basic Calculator.go b/leetcode/0224.Basic-Calculator/224. Basic Calculator.go
index 0804a1b4..29400c92 100644
--- a/leetcode/0224.Basic-Calculator/224. Basic Calculator.go
+++ b/leetcode/0224.Basic-Calculator/224. Basic Calculator.go
@@ -53,7 +53,7 @@ func calculate1(s string) int {
break
}
}
- tmp = string(stack[index+1 : len(stack)])
+ tmp = string(stack[index+1:])
stack = stack[:index]
res := strconv.Itoa(calculateStr(tmp))
for j := 0; j < len(res); j++ {
@@ -98,7 +98,6 @@ func calculateStr(str string) int {
if tmpStr != "" {
num, _ := strconv.Atoi(tmpStr)
nums = append(nums, num)
- tmpStr = ""
}
res = nums[0]
for i := 0; i < len(s); i++ {
diff --git a/leetcode/0224.Basic-Calculator/224. Basic Calculator_test.go b/leetcode/0224.Basic-Calculator/224. Basic Calculator_test.go
index 35e7b067..47331a69 100644
--- a/leetcode/0224.Basic-Calculator/224. Basic Calculator_test.go
+++ b/leetcode/0224.Basic-Calculator/224. Basic Calculator_test.go
@@ -26,21 +26,21 @@ func Test_Problem224(t *testing.T) {
qs := []question224{
- question224{
+ {
para224{"1 + 1"},
ans224{2},
},
- question224{
+ {
para224{" 2-1 + 2 "},
ans224{3},
},
- question224{
+ {
para224{"(1+(4+5+2)-3)+(6+8)"},
ans224{23},
},
- question224{
+ {
para224{"2-(5-6)"},
ans224{3},
},
diff --git a/leetcode/0226.Invert-Binary-Tree/226. Invert Binary Tree_test.go b/leetcode/0226.Invert-Binary-Tree/226. Invert Binary Tree_test.go
index 9e808b8d..9fde95dd 100644
--- a/leetcode/0226.Invert-Binary-Tree/226. Invert Binary Tree_test.go
+++ b/leetcode/0226.Invert-Binary-Tree/226. Invert Binary Tree_test.go
@@ -28,17 +28,17 @@ func Test_Problem226(t *testing.T) {
qs := []question226{
- question226{
+ {
para226{[]int{}},
ans226{[]int{}},
},
- question226{
+ {
para226{[]int{1}},
ans226{[]int{1}},
},
- question226{
+ {
para226{[]int{4, 2, 7, 1, 3, 6, 9}},
ans226{[]int{4, 7, 2, 9, 6, 3, 1}},
},
diff --git a/leetcode/0229.Majority-Element-II/229. Majority Element II_test.go b/leetcode/0229.Majority-Element-II/229. Majority Element II_test.go
index 2eb99c51..2450ae50 100644
--- a/leetcode/0229.Majority-Element-II/229. Majority Element II_test.go
+++ b/leetcode/0229.Majority-Element-II/229. Majority Element II_test.go
@@ -26,12 +26,12 @@ func Test_Problem229(t *testing.T) {
qs := []question229{
- question229{
+ {
para229{[]int{3, 2, 3}},
ans229{[]int{3}},
},
- question229{
+ {
para229{[]int{1, 1, 1, 3, 3, 2, 2, 2}},
ans229{[]int{1, 2}},
},
diff --git a/leetcode/0230.Kth-Smallest-Element-in-a-BST/230. Kth Smallest Element in a BST_test.go b/leetcode/0230.Kth-Smallest-Element-in-a-BST/230. Kth Smallest Element in a BST_test.go
index 3c5d52fd..4eb806ff 100644
--- a/leetcode/0230.Kth-Smallest-Element-in-a-BST/230. Kth Smallest Element in a BST_test.go
+++ b/leetcode/0230.Kth-Smallest-Element-in-a-BST/230. Kth Smallest Element in a BST_test.go
@@ -29,17 +29,17 @@ func Test_Problem230(t *testing.T) {
qs := []question230{
- question230{
+ {
para230{[]int{}, 0},
ans230{0},
},
- question230{
+ {
para230{[]int{3, 1, 4, structures.NULL, 2}, 1},
ans230{1},
},
- question230{
+ {
para230{[]int{5, 3, 6, 2, 4, structures.NULL, structures.NULL, 1}, 3},
ans230{3},
},
diff --git a/leetcode/0231.Power-of-Two/231. Power of Two_test.go b/leetcode/0231.Power-of-Two/231. Power of Two_test.go
index 5566b017..15b9681f 100644
--- a/leetcode/0231.Power-of-Two/231. Power of Two_test.go
+++ b/leetcode/0231.Power-of-Two/231. Power of Two_test.go
@@ -26,17 +26,17 @@ func Test_Problem231(t *testing.T) {
qs := []question231{
- question231{
+ {
para231{1},
ans231{true},
},
- question231{
+ {
para231{16},
ans231{true},
},
- question231{
+ {
para231{218},
ans231{false},
},
diff --git a/leetcode/0234.Palindrome-Linked-List/234. Palindrome Linked List_test.go b/leetcode/0234.Palindrome-Linked-List/234. Palindrome Linked List_test.go
index 74b0592c..8fd7a31a 100644
--- a/leetcode/0234.Palindrome-Linked-List/234. Palindrome Linked List_test.go
+++ b/leetcode/0234.Palindrome-Linked-List/234. Palindrome Linked List_test.go
@@ -28,52 +28,52 @@ func Test_Problem234(t *testing.T) {
qs := []question234{
- question234{
+ {
para234{[]int{1, 1, 2, 2, 3, 4, 4, 4}},
ans234{false},
},
- question234{
+ {
para234{[]int{1, 1, 1, 1, 1, 1}},
ans234{true},
},
- question234{
+ {
para234{[]int{1, 2, 2, 1, 3}},
ans234{false},
},
- question234{
+ {
para234{[]int{1}},
ans234{true},
},
- question234{
+ {
para234{[]int{}},
ans234{true},
},
- question234{
+ {
para234{[]int{1, 2, 2, 2, 2, 1}},
ans234{true},
},
- question234{
+ {
para234{[]int{1, 2, 2, 3, 3, 3, 3, 2, 2, 1}},
ans234{true},
},
- question234{
+ {
para234{[]int{1, 2}},
ans234{false},
},
- question234{
+ {
para234{[]int{1, 0, 1}},
ans234{true},
},
- question234{
+ {
para234{[]int{1, 1, 2, 1}},
ans234{false},
},
diff --git a/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree/235. Lowest Common Ancestor of a Binary Search Tree_test.go b/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree/235. Lowest Common Ancestor of a Binary Search Tree_test.go
index a42c7012..675dddc1 100644
--- a/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree/235. Lowest Common Ancestor of a Binary Search Tree_test.go
+++ b/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree/235. Lowest Common Ancestor of a Binary Search Tree_test.go
@@ -30,17 +30,17 @@ func Test_Problem235(t *testing.T) {
qs := []question235{
- question235{
+ {
para235{[]int{}, []int{}, []int{}},
ans235{[]int{}},
},
- question235{
+ {
para235{[]int{6, 2, 8, 0, 4, 7, 9, structures.NULL, structures.NULL, 3, 5}, []int{2}, []int{8}},
ans235{[]int{6}},
},
- question235{
+ {
para235{[]int{6, 2, 8, 0, 4, 7, 9, structures.NULL, structures.NULL, 3, 5}, []int{2}, []int{4}},
ans235{[]int{2}},
},
diff --git a/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree/236. Lowest Common Ancestor of a Binary Tree_test.go b/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree/236. Lowest Common Ancestor of a Binary Tree_test.go
index eae15919..48a471f4 100644
--- a/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree/236. Lowest Common Ancestor of a Binary Tree_test.go
+++ b/leetcode/0236.Lowest-Common-Ancestor-of-a-Binary-Tree/236. Lowest Common Ancestor of a Binary Tree_test.go
@@ -30,27 +30,27 @@ func Test_Problem236(t *testing.T) {
qs := []question236{
- question236{
+ {
para236{[]int{}, []int{}, []int{}},
ans236{[]int{}},
},
- question236{
+ {
para236{[]int{3, 5, 1, 6, 2, 0, 8, structures.NULL, structures.NULL, 7, 4}, []int{5}, []int{1}},
ans236{[]int{3}},
},
- question236{
+ {
para236{[]int{3, 5, 1, 6, 2, 0, 8, structures.NULL, structures.NULL, 7, 4}, []int{5}, []int{4}},
ans236{[]int{5}},
},
- question236{
+ {
para236{[]int{6, 2, 8, 0, 4, 7, 9, structures.NULL, structures.NULL, 3, 5}, []int{2}, []int{8}},
ans236{[]int{6}},
},
- question236{
+ {
para236{[]int{6, 2, 8, 0, 4, 7, 9, structures.NULL, structures.NULL, 3, 5}, []int{2}, []int{4}},
ans236{[]int{2}},
},
diff --git a/leetcode/0237.Delete-Node-in-a-Linked-List/237. Delete Node in a Linked List_test.go b/leetcode/0237.Delete-Node-in-a-Linked-List/237. Delete Node in a Linked List_test.go
index 81c370e8..29e43c34 100644
--- a/leetcode/0237.Delete-Node-in-a-Linked-List/237. Delete Node in a Linked List_test.go
+++ b/leetcode/0237.Delete-Node-in-a-Linked-List/237. Delete Node in a Linked List_test.go
@@ -29,37 +29,37 @@ func Test_Problem237(t *testing.T) {
qs := []question237{
- question237{
+ {
para237{[]int{1, 2, 3, 4, 5}, 1},
ans237{[]int{2, 3, 4, 5}},
},
- question237{
+ {
para237{[]int{1, 2, 3, 4, 5}, 2},
ans237{[]int{1, 3, 4, 5}},
},
- question237{
+ {
para237{[]int{1, 1, 1, 1, 1}, 1},
ans237{[]int{}},
},
- question237{
+ {
para237{[]int{1, 2, 3, 4, 5}, 5},
ans237{[]int{1, 2, 3, 4}},
},
- question237{
+ {
para237{[]int{}, 5},
ans237{[]int{}},
},
- question237{
+ {
para237{[]int{1, 2, 3, 4, 5}, 10},
ans237{[]int{1, 2, 3, 4, 5}},
},
- question237{
+ {
para237{[]int{1}, 1},
ans237{[]int{}},
},
diff --git a/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum.go b/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum.go
index 5b0425eb..805ea08b 100644
--- a/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum.go
+++ b/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum.go
@@ -29,7 +29,7 @@ func maxSlidingWindow(nums []int, k int) []int {
result := make([]int, 0, len(nums)-k+1)
for i, v := range nums { // if the left-most index is out of window, remove it
if i >= k && window[0] <= i-k {
- window = window[1:len(window)]
+ window = window[1:]
}
for len(window) > 0 && nums[window[len(window)-1]] < v { // maintain window
window = window[0 : len(window)-1]
diff --git a/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum_test.go b/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum_test.go
index ce348a42..a8e54298 100644
--- a/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum_test.go
+++ b/leetcode/0239.Sliding-Window-Maximum/239. Sliding Window Maximum_test.go
@@ -27,7 +27,7 @@ func Test_Problem239(t *testing.T) {
qs := []question239{
- question239{
+ {
para239{[]int{1, 3, -1, -3, 5, 3, 6, 7}, 3},
ans239{[]int{3, 3, 5, 5, 6, 7}},
},
diff --git a/leetcode/0240.Search-a-2D-Matrix-II/240. Search a 2D Matrix II_test.go b/leetcode/0240.Search-a-2D-Matrix-II/240. Search a 2D Matrix II_test.go
index 22e5efe6..e8a3d915 100644
--- a/leetcode/0240.Search-a-2D-Matrix-II/240. Search a 2D Matrix II_test.go
+++ b/leetcode/0240.Search-a-2D-Matrix-II/240. Search a 2D Matrix II_test.go
@@ -27,13 +27,13 @@ func Test_Problem240(t *testing.T) {
qs := []question240{
- question240{
- para240{[][]int{[]int{1, 4, 7, 11, 15}, []int{2, 5, 8, 12, 19}, []int{3, 6, 9, 16, 22}, []int{10, 13, 14, 17, 24}, []int{18, 21, 23, 26, 30}}, 5},
+ {
+ para240{[][]int{{1, 4, 7, 11, 15}, {2, 5, 8, 12, 19}, {3, 6, 9, 16, 22}, {10, 13, 14, 17, 24}, {18, 21, 23, 26, 30}}, 5},
ans240{true},
},
- question240{
- para240{[][]int{[]int{1, 4, 7, 11, 15}, []int{2, 5, 8, 12, 19}, []int{3, 6, 9, 16, 22}, []int{10, 13, 14, 17, 24}, []int{18, 21, 23, 26, 30}}, 20},
+ {
+ para240{[][]int{{1, 4, 7, 11, 15}, {2, 5, 8, 12, 19}, {3, 6, 9, 16, 22}, {10, 13, 14, 17, 24}, {18, 21, 23, 26, 30}}, 20},
ans240{false},
},
}
diff --git a/leetcode/0242.Valid-Anagram/242. Valid Anagram_test.go b/leetcode/0242.Valid-Anagram/242. Valid Anagram_test.go
index e9b363fa..15a108ca 100644
--- a/leetcode/0242.Valid-Anagram/242. Valid Anagram_test.go
+++ b/leetcode/0242.Valid-Anagram/242. Valid Anagram_test.go
@@ -27,21 +27,21 @@ func Test_Problem242(t *testing.T) {
qs := []question242{
- question242{
+ {
para242{"", ""},
ans242{true},
},
- question242{
+ {
para242{"", "1"},
ans242{false},
},
- question242{
+ {
para242{"anagram", "nagaram"},
ans242{true},
},
- question242{
+ {
para242{"rat", "car"},
ans242{false},
},
diff --git a/leetcode/0257.Binary-Tree-Paths/257. Binary Tree Paths_test.go b/leetcode/0257.Binary-Tree-Paths/257. Binary Tree Paths_test.go
index cba57aaf..dcea1685 100644
--- a/leetcode/0257.Binary-Tree-Paths/257. Binary Tree Paths_test.go
+++ b/leetcode/0257.Binary-Tree-Paths/257. Binary Tree Paths_test.go
@@ -28,17 +28,17 @@ func Test_Problem257(t *testing.T) {
qs := []question257{
- question257{
+ {
para257{[]int{}},
ans257{[]string{""}},
},
- question257{
+ {
para257{[]int{1, 2, 3, structures.NULL, 5, structures.NULL, structures.NULL}},
ans257{[]string{"1->2->5", "1->3"}},
},
- question257{
+ {
para257{[]int{1, 2, 3, 4, 5, 6, 7}},
ans257{[]string{"1->2->4", "1->2->5", "1->2->4", "1->2->5", "1->3->6", "1->3->7"}},
},
diff --git a/leetcode/0258.Add-Digits/258. Add Digits_test.go b/leetcode/0258.Add-Digits/258. Add Digits_test.go
index 78754617..3aed6777 100644
--- a/leetcode/0258.Add-Digits/258. Add Digits_test.go
+++ b/leetcode/0258.Add-Digits/258. Add Digits_test.go
@@ -26,17 +26,17 @@ func Test_Problem258(t *testing.T) {
qs := []question258{
- question258{
+ {
para258{38},
ans258{2},
},
- question258{
+ {
para258{88},
ans258{7},
},
- question258{
+ {
para258{96},
ans258{6},
},
diff --git a/leetcode/0260.Single-Number-III/260. Single Number III_test.go b/leetcode/0260.Single-Number-III/260. Single Number III_test.go
index 860605b4..720f4c30 100644
--- a/leetcode/0260.Single-Number-III/260. Single Number III_test.go
+++ b/leetcode/0260.Single-Number-III/260. Single Number III_test.go
@@ -26,7 +26,7 @@ func Test_Problem260(t *testing.T) {
qs := []question260{
- question260{
+ {
para260{[]int{1, 2, 1, 3, 2, 5}},
ans260{[]int{3, 5}},
},
diff --git a/leetcode/0263.Ugly-Number/263. Ugly Number_test.go b/leetcode/0263.Ugly-Number/263. Ugly Number_test.go
index 83a96e00..72ba1385 100644
--- a/leetcode/0263.Ugly-Number/263. Ugly Number_test.go
+++ b/leetcode/0263.Ugly-Number/263. Ugly Number_test.go
@@ -26,17 +26,17 @@ func Test_Problem263(t *testing.T) {
qs := []question263{
- question263{
+ {
para263{6},
ans263{true},
},
- question263{
+ {
para263{8},
ans263{true},
},
- question263{
+ {
para263{14},
ans263{false},
},
diff --git a/leetcode/0268.Missing-Number/268. Missing Number_test.go b/leetcode/0268.Missing-Number/268. Missing Number_test.go
index 5997ec6e..a3a7246c 100644
--- a/leetcode/0268.Missing-Number/268. Missing Number_test.go
+++ b/leetcode/0268.Missing-Number/268. Missing Number_test.go
@@ -26,12 +26,12 @@ func Test_Problem268(t *testing.T) {
qs := []question268{
- question268{
+ {
para268{[]int{3, 0, 1}},
ans268{2},
},
- question268{
+ {
para268{[]int{9, 6, 4, 2, 3, 5, 7, 0, 1}},
ans268{8},
},
diff --git a/leetcode/0274.H-Index/274. H-Index_test.go b/leetcode/0274.H-Index/274. H-Index_test.go
index b302ab8e..35e178da 100644
--- a/leetcode/0274.H-Index/274. H-Index_test.go
+++ b/leetcode/0274.H-Index/274. H-Index_test.go
@@ -26,21 +26,21 @@ func Test_Problem274(t *testing.T) {
qs := []question274{
- question274{
+ {
para274{[]int{3, 6, 9, 1}},
ans274{3},
},
- question274{
+ {
para274{[]int{1}},
ans274{1},
},
- question274{
+ {
para274{[]int{}},
ans274{0},
},
- question274{
+ {
para274{[]int{3, 0, 6, 1, 5}},
ans274{3},
},
diff --git a/leetcode/0275.H-Index-II/275. H-Index II_test.go b/leetcode/0275.H-Index-II/275. H-Index II_test.go
index 87b8a55b..c0ac4e36 100644
--- a/leetcode/0275.H-Index-II/275. H-Index II_test.go
+++ b/leetcode/0275.H-Index-II/275. H-Index II_test.go
@@ -26,26 +26,26 @@ func Test_Problem275(t *testing.T) {
qs := []question275{
- question275{
+ {
para275{[]int{3, 6, 9, 1}},
ans275{3},
},
- question275{
+ {
para275{[]int{1}},
ans275{1},
},
- question275{
+ {
para275{[]int{}},
ans275{0},
},
- question275{
+ {
para275{[]int{3, 0, 6, 1, 5}},
ans275{3},
},
- question275{
+ {
para275{[]int{0, 1, 3, 5, 6}},
ans275{3},
},
diff --git a/leetcode/0283.Move-Zeroes/283. Move Zeroes_test.go b/leetcode/0283.Move-Zeroes/283. Move Zeroes_test.go
index 68bc1042..1cc7e531 100644
--- a/leetcode/0283.Move-Zeroes/283. Move Zeroes_test.go
+++ b/leetcode/0283.Move-Zeroes/283. Move Zeroes_test.go
@@ -26,32 +26,32 @@ func Test_Problem283(t *testing.T) {
qs := []question283{
- question283{
+ {
para283{[]int{1, 0, 1}},
ans283{[]int{1, 1, 0}},
},
- question283{
+ {
para283{[]int{0, 1, 0, 3, 0, 12}},
ans283{[]int{1, 3, 12, 0, 0, 0}},
},
- question283{
+ {
para283{[]int{0, 1, 0, 3, 0, 0, 0, 0, 1, 12}},
ans283{[]int{1, 3, 1, 12, 0, 0, 0, 0, 0}},
},
- question283{
+ {
para283{[]int{0, 0, 0, 0, 0, 0, 0, 0, 12, 1}},
ans283{[]int{12, 1, 0, 0, 0, 0, 0, 0, 0, 0}},
},
- question283{
+ {
para283{[]int{0, 0, 0, 0, 0}},
ans283{[]int{0, 0, 0, 0, 0}},
},
- question283{
+ {
para283{[]int{1}},
ans283{[]int{1}},
},
diff --git a/leetcode/0287.Find-the-Duplicate-Number/287. Find the Duplicate Number_test.go b/leetcode/0287.Find-the-Duplicate-Number/287. Find the Duplicate Number_test.go
index 96331f6b..6e4aa1b0 100644
--- a/leetcode/0287.Find-the-Duplicate-Number/287. Find the Duplicate Number_test.go
+++ b/leetcode/0287.Find-the-Duplicate-Number/287. Find the Duplicate Number_test.go
@@ -26,17 +26,17 @@ func Test_Problem287(t *testing.T) {
qs := []question287{
- question287{
+ {
para287{[]int{1, 3, 4, 2, 2}},
ans287{2},
},
- question287{
+ {
para287{[]int{3, 1, 3, 4, 2}},
ans287{3},
},
- question287{
+ {
para287{[]int{2, 2, 2, 2, 2}},
ans287{2},
},
diff --git a/leetcode/0290.Word-Pattern/290. Word Pattern_test.go b/leetcode/0290.Word-Pattern/290. Word Pattern_test.go
index c9356501..4997c0ed 100644
--- a/leetcode/0290.Word-Pattern/290. Word Pattern_test.go
+++ b/leetcode/0290.Word-Pattern/290. Word Pattern_test.go
@@ -27,22 +27,22 @@ func Test_Problem290(t *testing.T) {
qs := []question290{
- question290{
+ {
para290{"abba", "dog cat cat dog"},
ans290{true},
},
- question290{
+ {
para290{"abba", "dog cat cat fish"},
ans290{false},
},
- question290{
+ {
para290{"aaaa", "dog cat cat dog"},
ans290{false},
},
- question290{
+ {
para290{"abba", "dog dog dog dog"},
ans290{false},
},
diff --git a/leetcode/0300.Longest-Increasing-Subsequence/300. Longest Increasing Subsequence_test.go b/leetcode/0300.Longest-Increasing-Subsequence/300. Longest Increasing Subsequence_test.go
index 17d5a36b..074c712e 100644
--- a/leetcode/0300.Longest-Increasing-Subsequence/300. Longest Increasing Subsequence_test.go
+++ b/leetcode/0300.Longest-Increasing-Subsequence/300. Longest Increasing Subsequence_test.go
@@ -26,7 +26,7 @@ func Test_Problem300(t *testing.T) {
qs := []question300{
- question300{
+ {
para300{[]int{10, 9, 2, 5, 3, 7, 101, 18}},
ans300{4},
},
diff --git a/leetcode/0306.Additive-Number/306. Additive Number_test.go b/leetcode/0306.Additive-Number/306. Additive Number_test.go
index 80e1478e..8191d720 100644
--- a/leetcode/0306.Additive-Number/306. Additive Number_test.go
+++ b/leetcode/0306.Additive-Number/306. Additive Number_test.go
@@ -26,12 +26,12 @@ func Test_Problem306(t *testing.T) {
qs := []question306{
- question306{
+ {
para306{"112358"},
ans306{true},
},
- question306{
+ {
para306{"199100199"},
ans306{true},
},
diff --git a/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown/309. Best Time to Buy and Sell Stock with Cooldown_test.go b/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown/309. Best Time to Buy and Sell Stock with Cooldown_test.go
index ed8a0418..1204bef6 100644
--- a/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown/309. Best Time to Buy and Sell Stock with Cooldown_test.go
+++ b/leetcode/0309.Best-Time-to-Buy-and-Sell-Stock-with-Cooldown/309. Best Time to Buy and Sell Stock with Cooldown_test.go
@@ -26,32 +26,32 @@ func Test_Problem309(t *testing.T) {
qs := []question309{
- question309{
+ {
para309{[]int{}},
ans309{0},
},
- question309{
+ {
para309{[]int{2, 1, 4, 5, 2, 9, 7}},
ans309{10},
},
- question309{
+ {
para309{[]int{6, 1, 3, 2, 4, 7}},
ans309{6},
},
- question309{
+ {
para309{[]int{1, 2, 3, 0, 2}},
ans309{3},
},
- question309{
+ {
para309{[]int{7, 1, 5, 3, 6, 4}},
ans309{5},
},
- question309{
+ {
para309{[]int{7, 6, 4, 3, 1}},
ans309{0},
},
diff --git a/leetcode/0315.Count-of-Smaller-Numbers-After-Self/315. Count of Smaller Numbers After Self_test.go b/leetcode/0315.Count-of-Smaller-Numbers-After-Self/315. Count of Smaller Numbers After Self_test.go
index 82b31ad6..35579fcf 100644
--- a/leetcode/0315.Count-of-Smaller-Numbers-After-Self/315. Count of Smaller Numbers After Self_test.go
+++ b/leetcode/0315.Count-of-Smaller-Numbers-After-Self/315. Count of Smaller Numbers After Self_test.go
@@ -26,17 +26,17 @@ func Test_Problem315(t *testing.T) {
qs := []question315{
- question315{
+ {
para315{[]int{5, 2, 6, 1}},
ans315{[]int{2, 1, 1, 0}},
},
- question315{
+ {
para315{[]int{-1, -1}},
ans315{[]int{0, 0}},
},
- question315{
+ {
para315{[]int{26, 78, 27, 100, 33, 67, 90, 23, 66, 5, 38, 7, 35, 23, 52, 22, 83, 51, 98, 69, 81, 32, 78, 28, 94, 13, 2, 97, 3, 76, 99, 51, 9, 21, 84, 66, 65, 36, 100, 41}},
ans315{[]int{10, 27, 10, 35, 12, 22, 28, 8, 19, 2, 12, 2, 9, 6, 12, 5, 17, 9, 19, 12, 14, 6, 12, 5, 12, 3, 0, 10, 0, 7, 8, 4, 0, 0, 4, 3, 2, 0, 1, 0}},
},
diff --git a/leetcode/0318.Maximum-Product-of-Word-Lengths/318. Maximum Product of Word Lengths_test.go b/leetcode/0318.Maximum-Product-of-Word-Lengths/318. Maximum Product of Word Lengths_test.go
index 84078b20..3c7a10fd 100644
--- a/leetcode/0318.Maximum-Product-of-Word-Lengths/318. Maximum Product of Word Lengths_test.go
+++ b/leetcode/0318.Maximum-Product-of-Word-Lengths/318. Maximum Product of Word Lengths_test.go
@@ -26,17 +26,17 @@ func Test_Problem318(t *testing.T) {
qs := []question318{
- question318{
+ {
para318{[]string{"abcw", "baz", "foo", "bar", "xtfn", "abcdef"}},
ans318{16},
},
- question318{
+ {
para318{[]string{"a", "ab", "abc", "d", "cd", "bcd", "abcd"}},
ans318{4},
},
- question318{
+ {
para318{[]string{"a", "aa", "aaa", "aaaa"}},
ans318{0},
},
diff --git a/leetcode/0322.Coin-Change/322. Coin Change_test.go b/leetcode/0322.Coin-Change/322. Coin Change_test.go
index 90363403..8f7fe2f5 100644
--- a/leetcode/0322.Coin-Change/322. Coin Change_test.go
+++ b/leetcode/0322.Coin-Change/322. Coin Change_test.go
@@ -27,26 +27,26 @@ func Test_Problem322(t *testing.T) {
qs := []question322{
- question322{
+ {
para322{[]int{186, 419, 83, 408}, 6249},
ans322{20},
},
- question322{
+ {
para322{[]int{1, 2147483647}, 2},
ans322{2},
},
- question322{
+ {
para322{[]int{1, 2, 5}, 11},
ans322{3},
},
- question322{
+ {
para322{[]int{2}, 3},
ans322{-1},
},
- question322{
+ {
para322{[]int{1}, 0},
ans322{0},
},
diff --git a/leetcode/0324.Wiggle-Sort-II/324. Wiggle Sort II_test.go b/leetcode/0324.Wiggle-Sort-II/324. Wiggle Sort II_test.go
index a9c4cba5..9885673b 100644
--- a/leetcode/0324.Wiggle-Sort-II/324. Wiggle Sort II_test.go
+++ b/leetcode/0324.Wiggle-Sort-II/324. Wiggle Sort II_test.go
@@ -26,27 +26,27 @@ func Test_Problem324(t *testing.T) {
qs := []question324{
- question324{
+ {
para324{[]int{}},
ans324{[]int{}},
},
- question324{
+ {
para324{[]int{1}},
ans324{[]int{1}},
},
- question324{
+ {
para324{[]int{1, 5, 1, 1, 6, 4}},
ans324{[]int{1, 4, 1, 5, 1, 6}},
},
- question324{
+ {
para324{[]int{1, 3, 2, 2, 3, 1}},
ans324{[]int{2, 3, 1, 3, 1, 2}},
},
- question324{
+ {
para324{[]int{1, 1, 2, 1, 2, 2, 1}},
ans324{[]int{1, 2, 1, 2, 1, 2, 1}},
},
diff --git a/leetcode/0326.Power-of-Three/326. Power of Three_test.go b/leetcode/0326.Power-of-Three/326. Power of Three_test.go
index b338d872..48ba0a6f 100644
--- a/leetcode/0326.Power-of-Three/326. Power of Three_test.go
+++ b/leetcode/0326.Power-of-Three/326. Power of Three_test.go
@@ -26,22 +26,22 @@ func Test_Problem326(t *testing.T) {
qs := []question326{
- question326{
+ {
para326{27},
ans326{true},
},
- question326{
+ {
para326{0},
ans326{false},
},
- question326{
+ {
para326{9},
ans326{true},
},
- question326{
+ {
para326{45},
ans326{false},
},
diff --git a/leetcode/0327.Count-of-Range-Sum/327. Count of Range Sum_test.go b/leetcode/0327.Count-of-Range-Sum/327. Count of Range Sum_test.go
index e0512ed7..555a63e4 100644
--- a/leetcode/0327.Count-of-Range-Sum/327. Count of Range Sum_test.go
+++ b/leetcode/0327.Count-of-Range-Sum/327. Count of Range Sum_test.go
@@ -28,17 +28,17 @@ func Test_Problem327(t *testing.T) {
qs := []question327{
- question327{
+ {
para327{[]int{-2, 5, -1}, -2, 2},
ans327{3},
},
- question327{
+ {
para327{[]int{0, -3, -3, 1, 1, 2}, 3, 5},
ans327{2},
},
- question327{
+ {
para327{[]int{-3, 1, 2, -2, 2, -1}, -3, -1},
ans327{7},
},
diff --git a/leetcode/0328.Odd-Even-Linked-List/328. Odd Even Linked List_test.go b/leetcode/0328.Odd-Even-Linked-List/328. Odd Even Linked List_test.go
index 5e3547ac..6488dd54 100644
--- a/leetcode/0328.Odd-Even-Linked-List/328. Odd Even Linked List_test.go
+++ b/leetcode/0328.Odd-Even-Linked-List/328. Odd Even Linked List_test.go
@@ -28,37 +28,37 @@ func Test_Problem328(t *testing.T) {
qs := []question328{
- question328{
+ {
para328{[]int{1, 4, 3, 2, 5, 2}},
ans328{[]int{1, 3, 5, 4, 2, 2}},
},
- question328{
+ {
para328{[]int{1, 1, 2, 2, 3, 3, 3}},
ans328{[]int{1, 2, 3, 3, 1, 2, 3}},
},
- question328{
+ {
para328{[]int{4, 3, 2, 5, 2}},
ans328{[]int{4, 2, 2, 3, 5}},
},
- question328{
+ {
para328{[]int{1, 1, 1, 1, 1, 1}},
ans328{[]int{1, 1, 1, 1, 1, 1}},
},
- question328{
+ {
para328{[]int{3, 1}},
ans328{[]int{3, 1}},
},
- question328{
+ {
para328{[]int{1, 2, 3, 4, 5}},
ans328{[]int{1, 3, 5, 2, 4}},
},
- question328{
+ {
para328{[]int{}},
ans328{[]int{}},
},
diff --git a/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix.go b/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix.go
index 2e43102f..74287a05 100644
--- a/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix.go
+++ b/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix.go
@@ -5,10 +5,10 @@ import (
)
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func longestIncreasingPath(matrix [][]int) int {
diff --git a/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix_test.go b/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix_test.go
index 4d8d754d..cda6bfe2 100644
--- a/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix_test.go
+++ b/leetcode/0329.Longest-Increasing-Path-in-a-Matrix/329. Longest Increasing Path in a Matrix_test.go
@@ -26,33 +26,33 @@ func Test_Problem329(t *testing.T) {
qs := []question329{
- question329{
- para329{[][]int{[]int{1}}},
+ {
+ para329{[][]int{{1}}},
ans329{1},
},
- question329{
- para329{[][]int{[]int{}}},
+ {
+ para329{[][]int{{}}},
ans329{0},
},
- question329{
- para329{[][]int{[]int{9, 9, 4}, []int{6, 6, 8}, []int{2, 1, 1}}},
+ {
+ para329{[][]int{{9, 9, 4}, {6, 6, 8}, {2, 1, 1}}},
ans329{4},
},
- question329{
- para329{[][]int{[]int{3, 4, 5}, []int{3, 2, 6}, []int{2, 2, 1}}},
+ {
+ para329{[][]int{{3, 4, 5}, {3, 2, 6}, {2, 2, 1}}},
ans329{4},
},
- question329{
- para329{[][]int{[]int{1, 5, 9}, []int{10, 11, 13}, []int{12, 13, 15}}},
+ {
+ para329{[][]int{{1, 5, 9}, {10, 11, 13}, {12, 13, 15}}},
ans329{5},
},
- question329{
- para329{[][]int{[]int{1, 5, 7}, []int{11, 12, 13}, []int{12, 13, 15}}},
+ {
+ para329{[][]int{{1, 5, 7}, {11, 12, 13}, {12, 13, 15}}},
ans329{5},
},
}
diff --git a/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree/331. Verify Preorder Serialization of a Binary Tree_test.go b/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree/331. Verify Preorder Serialization of a Binary Tree_test.go
index 026f13d2..977626fc 100644
--- a/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree/331. Verify Preorder Serialization of a Binary Tree_test.go
+++ b/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree/331. Verify Preorder Serialization of a Binary Tree_test.go
@@ -26,17 +26,17 @@ func Test_Problem331(t *testing.T) {
qs := []question331{
- question331{
+ {
para331{"9,3,4,#,#,1,#,#,2,#,6,#,#"},
ans331{true},
},
- question331{
+ {
para331{"1,#"},
ans331{false},
},
- question331{
+ {
para331{"9,#,#,1"},
ans331{false},
},
diff --git a/leetcode/0337.House-Robber-III/337. House Robber III_test.go b/leetcode/0337.House-Robber-III/337. House Robber III_test.go
index f25f1d4c..a05c7edb 100644
--- a/leetcode/0337.House-Robber-III/337. House Robber III_test.go
+++ b/leetcode/0337.House-Robber-III/337. House Robber III_test.go
@@ -28,17 +28,17 @@ func Test_Problem337(t *testing.T) {
qs := []question337{
- question337{
+ {
para337{[]int{3, 2, 3, structures.NULL, 3, structures.NULL, 1}},
ans337{7},
},
- question337{
+ {
para337{[]int{}},
ans337{0},
},
- question337{
+ {
para337{[]int{3, 4, 5, 1, 3, structures.NULL, 1}},
ans337{9},
},
diff --git a/leetcode/0338.Counting-Bits/338. Counting Bits_test.go b/leetcode/0338.Counting-Bits/338. Counting Bits_test.go
index b69f10e1..2ae0f7b5 100644
--- a/leetcode/0338.Counting-Bits/338. Counting Bits_test.go
+++ b/leetcode/0338.Counting-Bits/338. Counting Bits_test.go
@@ -26,12 +26,12 @@ func Test_Problem338(t *testing.T) {
qs := []question338{
- question338{
+ {
para338{2},
ans338{[]int{0, 1, 1}},
},
- question338{
+ {
para338{5},
ans338{[]int{0, 1, 1, 2, 1, 2}},
},
diff --git a/leetcode/0342.Power-of-Four/342. Power of Four_test.go b/leetcode/0342.Power-of-Four/342. Power of Four_test.go
index 7c5c4cfc..637f3b98 100644
--- a/leetcode/0342.Power-of-Four/342. Power of Four_test.go
+++ b/leetcode/0342.Power-of-Four/342. Power of Four_test.go
@@ -26,12 +26,12 @@ func Test_Problem342(t *testing.T) {
qs := []question342{
- question342{
+ {
para342{16},
ans342{true},
},
- question342{
+ {
para342{5},
ans342{false},
},
diff --git a/leetcode/0343.Integer-Break/343. Integer Break_test.go b/leetcode/0343.Integer-Break/343. Integer Break_test.go
index e82a448a..b6228af4 100644
--- a/leetcode/0343.Integer-Break/343. Integer Break_test.go
+++ b/leetcode/0343.Integer-Break/343. Integer Break_test.go
@@ -26,12 +26,12 @@ func Test_Problem343(t *testing.T) {
qs := []question343{
- question343{
+ {
para343{2},
ans343{1},
},
- question343{
+ {
para343{10},
ans343{36},
},
diff --git a/leetcode/0344.Reverse-String/344. Reverse String_test.go b/leetcode/0344.Reverse-String/344. Reverse String_test.go
index 71f4f554..68aa77b9 100644
--- a/leetcode/0344.Reverse-String/344. Reverse String_test.go
+++ b/leetcode/0344.Reverse-String/344. Reverse String_test.go
@@ -26,12 +26,12 @@ func Test_Problem344(t *testing.T) {
qs := []question344{
- question344{
+ {
para344{[]byte{'h', 'e', 'l', 'l', 'o'}},
ans344{[]byte{'o', 'l', 'l', 'e', 'h'}},
},
- question344{
+ {
para344{[]byte{'H', 'a', 'n', 'n', 'a', 'h'}},
ans344{[]byte{'h', 'a', 'n', 'n', 'a', 'H'}},
},
diff --git a/leetcode/0345.Reverse-Vowels-of-a-String/345. Reverse Vowels of a String_test.go b/leetcode/0345.Reverse-Vowels-of-a-String/345. Reverse Vowels of a String_test.go
index c47420a1..74585a12 100644
--- a/leetcode/0345.Reverse-Vowels-of-a-String/345. Reverse Vowels of a String_test.go
+++ b/leetcode/0345.Reverse-Vowels-of-a-String/345. Reverse Vowels of a String_test.go
@@ -26,17 +26,17 @@ func Test_Problem345(t *testing.T) {
qs := []question345{
- question345{
+ {
para345{"hello"},
ans345{"holle"},
},
- question345{
+ {
para345{"leetcode"},
ans345{"leotcede"},
},
- question345{
+ {
para345{"aA"},
ans345{"Aa"},
},
diff --git a/leetcode/0347.Top-K-Frequent-Elements/347. Top K Frequent Elements_test.go b/leetcode/0347.Top-K-Frequent-Elements/347. Top K Frequent Elements_test.go
index 8d28f9ad..0e6f050f 100644
--- a/leetcode/0347.Top-K-Frequent-Elements/347. Top K Frequent Elements_test.go
+++ b/leetcode/0347.Top-K-Frequent-Elements/347. Top K Frequent Elements_test.go
@@ -27,12 +27,12 @@ func Test_Problem347(t *testing.T) {
qs := []question347{
- question347{
+ {
para347{[]int{1, 1, 1, 2, 2, 3}, 2},
ans347{[]int{1, 2}},
},
- question347{
+ {
para347{[]int{1}, 1},
ans347{[]int{1}},
},
diff --git a/leetcode/0349.Intersection-of-Two-Arrays/349. Intersection of Two Arrays_test.go b/leetcode/0349.Intersection-of-Two-Arrays/349. Intersection of Two Arrays_test.go
index b17d4b5b..f4cc3319 100644
--- a/leetcode/0349.Intersection-of-Two-Arrays/349. Intersection of Two Arrays_test.go
+++ b/leetcode/0349.Intersection-of-Two-Arrays/349. Intersection of Two Arrays_test.go
@@ -27,32 +27,32 @@ func Test_Problem349(t *testing.T) {
qs := []question349{
- question349{
+ {
para349{[]int{}, []int{}},
ans349{[]int{}},
},
- question349{
+ {
para349{[]int{1}, []int{1}},
ans349{[]int{1}},
},
- question349{
+ {
para349{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans349{[]int{1, 2, 3, 4}},
},
- question349{
+ {
para349{[]int{1, 2, 2, 1}, []int{2, 2}},
ans349{[]int{2}},
},
- question349{
+ {
para349{[]int{1}, []int{9, 9, 9, 9, 9}},
ans349{[]int{}},
},
- question349{
+ {
para349{[]int{4, 9, 5}, []int{9, 4, 9, 8, 4}},
ans349{[]int{9, 4}},
},
diff --git a/leetcode/0350.Intersection-of-Two-Arrays-II/350. Intersection of Two Arrays II_test.go b/leetcode/0350.Intersection-of-Two-Arrays-II/350. Intersection of Two Arrays II_test.go
index 5ab6f411..cdfd4f76 100644
--- a/leetcode/0350.Intersection-of-Two-Arrays-II/350. Intersection of Two Arrays II_test.go
+++ b/leetcode/0350.Intersection-of-Two-Arrays-II/350. Intersection of Two Arrays II_test.go
@@ -27,37 +27,37 @@ func Test_Problem350(t *testing.T) {
qs := []question350{
- question350{
+ {
para350{[]int{}, []int{}},
ans350{[]int{}},
},
- question350{
+ {
para350{[]int{1}, []int{1}},
ans350{[]int{1}},
},
- question350{
+ {
para350{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans350{[]int{1, 2, 3, 4}},
},
- question350{
+ {
para350{[]int{1, 2, 2, 1}, []int{2, 2}},
ans350{[]int{2, 2}},
},
- question350{
+ {
para350{[]int{1}, []int{9, 9, 9, 9, 9}},
ans350{[]int{}},
},
- question350{
+ {
para350{[]int{4, 9, 5}, []int{9, 4, 9, 8, 4}},
ans350{[]int{9, 4}},
},
- question350{
+ {
para350{[]int{4, 9, 5, 9, 4}, []int{9, 4, 9, 8, 4, 7, 9, 4, 4, 9}},
ans350{[]int{9, 4, 9, 4}},
},
diff --git a/leetcode/0354.Russian-Doll-Envelopes/354. Russian Doll Envelopes_test.go b/leetcode/0354.Russian-Doll-Envelopes/354. Russian Doll Envelopes_test.go
index fecd0cf9..a477e019 100644
--- a/leetcode/0354.Russian-Doll-Envelopes/354. Russian Doll Envelopes_test.go
+++ b/leetcode/0354.Russian-Doll-Envelopes/354. Russian Doll Envelopes_test.go
@@ -26,8 +26,8 @@ func Test_Problem354(t *testing.T) {
qs := []question354{
- question354{
- para354{[][]int{[]int{5, 4}, []int{6, 4}, []int{6, 7}, []int{2, 3}}},
+ {
+ para354{[][]int{{5, 4}, {6, 4}, {6, 7}, {2, 3}}},
ans354{3},
},
}
diff --git a/leetcode/0357.Count-Numbers-with-Unique-Digits/357. Count Numbers with Unique Digits_test.go b/leetcode/0357.Count-Numbers-with-Unique-Digits/357. Count Numbers with Unique Digits_test.go
index 60b252d9..a2ea8955 100644
--- a/leetcode/0357.Count-Numbers-with-Unique-Digits/357. Count Numbers with Unique Digits_test.go
+++ b/leetcode/0357.Count-Numbers-with-Unique-Digits/357. Count Numbers with Unique Digits_test.go
@@ -26,32 +26,32 @@ func Test_Problem357(t *testing.T) {
qs := []question357{
- question357{
+ {
para357{1},
ans357{10},
},
- question357{
+ {
para357{2},
ans357{91},
},
- question357{
+ {
para357{3},
ans357{739},
},
- question357{
+ {
para357{4},
ans357{5275},
},
- question357{
+ {
para357{5},
ans357{32491},
},
- question357{
+ {
para357{6},
ans357{168571},
},
diff --git a/leetcode/0367.Valid-Perfect-Square/367. Valid Perfect Square_test.go b/leetcode/0367.Valid-Perfect-Square/367. Valid Perfect Square_test.go
index 2877dc4c..e7a1e6eb 100644
--- a/leetcode/0367.Valid-Perfect-Square/367. Valid Perfect Square_test.go
+++ b/leetcode/0367.Valid-Perfect-Square/367. Valid Perfect Square_test.go
@@ -26,37 +26,37 @@ func Test_Problem367(t *testing.T) {
qs := []question367{
- question367{
+ {
para367{1},
ans367{true},
},
- question367{
+ {
para367{2},
ans367{false},
},
- question367{
+ {
para367{3},
ans367{false},
},
- question367{
+ {
para367{4},
ans367{true},
},
- question367{
+ {
para367{5},
ans367{false},
},
- question367{
+ {
para367{6},
ans367{false},
},
- question367{
+ {
para367{104976},
ans367{true},
},
diff --git a/leetcode/0371.Sum-of-Two-Integers/371. Sum of Two Integers_test.go b/leetcode/0371.Sum-of-Two-Integers/371. Sum of Two Integers_test.go
index fa065c93..8a76c8dc 100644
--- a/leetcode/0371.Sum-of-Two-Integers/371. Sum of Two Integers_test.go
+++ b/leetcode/0371.Sum-of-Two-Integers/371. Sum of Two Integers_test.go
@@ -27,12 +27,12 @@ func Test_Problem371(t *testing.T) {
qs := []question371{
- question371{
+ {
para371{1, 2},
ans371{3},
},
- question371{
+ {
para371{-2, 3},
ans371{1},
},
diff --git a/leetcode/0372.Super-Pow/372. Super Pow_test.go b/leetcode/0372.Super-Pow/372. Super Pow_test.go
index c862d96c..75347ad4 100644
--- a/leetcode/0372.Super-Pow/372. Super Pow_test.go
+++ b/leetcode/0372.Super-Pow/372. Super Pow_test.go
@@ -27,12 +27,12 @@ func Test_Problem372(t *testing.T) {
qs := []question372{
- question372{
+ {
para372{2, []int{3}},
ans372{8},
},
- question372{
+ {
para372{2, []int{1, 0}},
ans372{1024},
},
diff --git a/leetcode/0373.Find-K-Pairs-with-Smallest-Sums/373. Find K Pairs with Smallest Sums_test.go b/leetcode/0373.Find-K-Pairs-with-Smallest-Sums/373. Find K Pairs with Smallest Sums_test.go
index 461b9e9f..214ace27 100644
--- a/leetcode/0373.Find-K-Pairs-with-Smallest-Sums/373. Find K Pairs with Smallest Sums_test.go
+++ b/leetcode/0373.Find-K-Pairs-with-Smallest-Sums/373. Find K Pairs with Smallest Sums_test.go
@@ -28,39 +28,39 @@ func Test_Problem373(t *testing.T) {
qs := []question373{
- question373{
+ {
para373{[]int{1, 7, 11}, []int{2, 4, 6}, 3},
- ans373{[][]int{[]int{1, 2}, []int{1, 4}, []int{1, 6}}},
+ ans373{[][]int{{1, 2}, {1, 4}, {1, 6}}},
},
- question373{
+ {
para373{[]int{1, 1, 2}, []int{1, 2, 3}, 2},
- ans373{[][]int{[]int{1, 1}, []int{1, 1}}},
+ ans373{[][]int{{1, 1}, {1, 1}}},
},
- question373{
+ {
para373{[]int{1, 2}, []int{3}, 3},
- ans373{[][]int{[]int{1, 3}, []int{2, 3}}},
+ ans373{[][]int{{1, 3}, {2, 3}}},
},
- question373{
+ {
para373{[]int{1, 2, 4, 5, 6}, []int{3, 5, 7, 9}, 3},
- ans373{[][]int{[]int{1, 3}, []int{2, 3}, []int{1, 5}}},
+ ans373{[][]int{{1, 3}, {2, 3}, {1, 5}}},
},
- question373{
+ {
para373{[]int{1, 1, 2}, []int{1, 2, 3}, 10},
- ans373{[][]int{[]int{1, 1}, []int{1, 1}, []int{2, 1}, []int{1, 2}, []int{1, 2}, []int{2, 2}, []int{1, 3}, []int{1, 3}, []int{2, 3}}},
+ ans373{[][]int{{1, 1}, {1, 1}, {2, 1}, {1, 2}, {1, 2}, {2, 2}, {1, 3}, {1, 3}, {2, 3}}},
},
- question373{
+ {
para373{[]int{-10, -4, 0, 0, 6}, []int{3, 5, 6, 7, 8, 100}, 10},
- ans373{[][]int{[]int{-10, 3}, []int{-10, 5}, []int{-10, 6}, []int{-10, 7}, []int{-10, 8}, []int{-4, 3}, []int{-4, 5}, []int{-4, 6}, []int{0, 3}, []int{0, 3}}},
+ ans373{[][]int{{-10, 3}, {-10, 5}, {-10, 6}, {-10, 7}, {-10, 8}, {-4, 3}, {-4, 5}, {-4, 6}, {0, 3}, {0, 3}}},
},
- question373{
+ {
para373{[]int{0, 0, 0, 0, 0}, []int{-3, 22, 35, 56, 76}, 22},
- ans373{[][]int{[]int{0, -3}, []int{0, -3}, []int{0, -3}, []int{0, -3}, []int{0, -3}, []int{0, 22}, []int{0, 22}, []int{0, 22}, []int{0, 22}, []int{0, 22}, []int{0, 35}, []int{0, 35}, []int{0, 35}, []int{0, 35}, []int{0, 35}, []int{0, 56}, []int{0, 56}, []int{0, 56}, []int{0, 56}, []int{0, 56}, []int{0, 76}, []int{0, 76}}},
+ ans373{[][]int{{0, -3}, {0, -3}, {0, -3}, {0, -3}, {0, -3}, {0, 22}, {0, 22}, {0, 22}, {0, 22}, {0, 22}, {0, 35}, {0, 35}, {0, 35}, {0, 35}, {0, 35}, {0, 56}, {0, 56}, {0, 56}, {0, 56}, {0, 56}, {0, 76}, {0, 76}}},
},
}
diff --git a/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix/378. Kth Smallest Element in a Sorted Matrix_test.go b/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix/378. Kth Smallest Element in a Sorted Matrix_test.go
index 8019a021..021828aa 100644
--- a/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix/378. Kth Smallest Element in a Sorted Matrix_test.go
+++ b/leetcode/0378.Kth-Smallest-Element-in-a-Sorted-Matrix/378. Kth Smallest Element in a Sorted Matrix_test.go
@@ -27,13 +27,13 @@ func Test_Problem378(t *testing.T) {
qs := []question378{
- question378{
- para378{[][]int{[]int{1, 5, 9}, []int{10, 11, 13}, []int{12, 13, 15}}, 8},
+ {
+ para378{[][]int{{1, 5, 9}, {10, 11, 13}, {12, 13, 15}}, 8},
ans378{13},
},
- question378{
- para378{[][]int{[]int{1, 5, 7}, []int{11, 12, 13}, []int{12, 13, 15}}, 3},
+ {
+ para378{[][]int{{1, 5, 7}, {11, 12, 13}, {12, 13, 15}}, 3},
ans378{9},
},
}
diff --git a/leetcode/0385.Mini-Parser/385. Mini Parser_test.go b/leetcode/0385.Mini-Parser/385. Mini Parser_test.go
index 8ca47fb5..f3efe64d 100644
--- a/leetcode/0385.Mini-Parser/385. Mini Parser_test.go
+++ b/leetcode/0385.Mini-Parser/385. Mini Parser_test.go
@@ -26,27 +26,27 @@ func Test_Problem385(t *testing.T) {
qs := []question385{
- question385{
+ {
para385{"[[]]"},
ans385{[]int{}},
},
- question385{
+ {
para385{"[]"},
ans385{[]int{}},
},
- question385{
+ {
para385{"[-1]"},
ans385{[]int{-1}},
},
- question385{
+ {
para385{"[123,[456,[789]]]"},
ans385{[]int{123, 456, 789}},
},
- question385{
+ {
para385{"324"},
ans385{[]int{324}},
},
diff --git a/leetcode/0386.Lexicographical-Numbers/386. Lexicographical Numbers_test.go b/leetcode/0386.Lexicographical-Numbers/386. Lexicographical Numbers_test.go
index 4a72edef..eb0d60fb 100644
--- a/leetcode/0386.Lexicographical-Numbers/386. Lexicographical Numbers_test.go
+++ b/leetcode/0386.Lexicographical-Numbers/386. Lexicographical Numbers_test.go
@@ -26,7 +26,7 @@ func Test_Problem386(t *testing.T) {
qs := []question386{
- question386{
+ {
para386{13},
ans386{[]int{1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9}},
},
diff --git a/leetcode/0387.First-Unique-Character-in-a-String/387. First Unique Character in a String_test.go b/leetcode/0387.First-Unique-Character-in-a-String/387. First Unique Character in a String_test.go
index a400f081..fd0b6d1f 100644
--- a/leetcode/0387.First-Unique-Character-in-a-String/387. First Unique Character in a String_test.go
+++ b/leetcode/0387.First-Unique-Character-in-a-String/387. First Unique Character in a String_test.go
@@ -26,12 +26,12 @@ func Test_Problem387(t *testing.T) {
qs := []question387{
- question387{
+ {
para387{"leetcode"},
ans387{0},
},
- question387{
+ {
para387{"loveleetcode"},
ans387{2},
},
diff --git a/leetcode/0389.Find-the-Difference/389. Find the Difference_test.go b/leetcode/0389.Find-the-Difference/389. Find the Difference_test.go
index a42b722e..6f31d7ad 100644
--- a/leetcode/0389.Find-the-Difference/389. Find the Difference_test.go
+++ b/leetcode/0389.Find-the-Difference/389. Find the Difference_test.go
@@ -27,7 +27,7 @@ func Test_Problem389(t *testing.T) {
qs := []question389{
- question389{
+ {
para389{"abcd", "abcde"},
ans389{'e'},
},
diff --git a/leetcode/0392.Is-Subsequence/392. Is Subsequence.go b/leetcode/0392.Is-Subsequence/392. Is Subsequence.go
index 0c9027b9..2098cb93 100644
--- a/leetcode/0392.Is-Subsequence/392. Is Subsequence.go
+++ b/leetcode/0392.Is-Subsequence/392. Is Subsequence.go
@@ -2,9 +2,9 @@ package leetcode
// 解法一 O(n^2)
func isSubsequence(s string, t string) bool {
- index, flag := 0, false
+ index := 0
for i := 0; i < len(s); i++ {
- flag = false
+ flag := false
for ; index < len(t); index++ {
if s[i] == t[index] {
flag = true
diff --git a/leetcode/0392.Is-Subsequence/392. Is Subsequence_test.go b/leetcode/0392.Is-Subsequence/392. Is Subsequence_test.go
index 8e2c023b..8c565e66 100644
--- a/leetcode/0392.Is-Subsequence/392. Is Subsequence_test.go
+++ b/leetcode/0392.Is-Subsequence/392. Is Subsequence_test.go
@@ -27,22 +27,22 @@ func Test_Problem392(t *testing.T) {
qs := []question392{
- question392{
+ {
para392{"abc", "ahbgdc"},
ans392{true},
},
- question392{
+ {
para392{"axc", "ahbgdc"},
ans392{false},
},
- question392{
+ {
para392{"acb", "ahbgdc"},
ans392{false},
},
- question392{
+ {
para392{"leeeeetcode", "yyyyylyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyytyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyycyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyoyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyydyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"},
ans392{false},
},
diff --git a/leetcode/0393.UTF-8-Validation/393. UTF-8 Validation_test.go b/leetcode/0393.UTF-8-Validation/393. UTF-8 Validation_test.go
index 9700becc..25ba67e6 100644
--- a/leetcode/0393.UTF-8-Validation/393. UTF-8 Validation_test.go
+++ b/leetcode/0393.UTF-8-Validation/393. UTF-8 Validation_test.go
@@ -26,12 +26,12 @@ func Test_Problem393(t *testing.T) {
qs := []question393{
- question393{
+ {
para393{[]int{197, 130, 1}},
ans393{true},
},
- question393{
+ {
para393{[]int{235, 140, 4}},
ans393{false},
},
diff --git a/leetcode/0394.Decode-String/394. Decode String_test.go b/leetcode/0394.Decode-String/394. Decode String_test.go
index 50846ccc..b7434e46 100644
--- a/leetcode/0394.Decode-String/394. Decode String_test.go
+++ b/leetcode/0394.Decode-String/394. Decode String_test.go
@@ -26,22 +26,22 @@ func Test_Problem394(t *testing.T) {
qs := []question394{
- question394{
+ {
para394{"10[a]"},
ans394{"aaaaaaaaaa"},
},
- question394{
+ {
para394{"3[a]2[bc]"},
ans394{"aaabcbc"},
},
- question394{
+ {
para394{"3[a2[c]]"},
ans394{"accaccacc"},
},
- question394{
+ {
para394{"2[abc]3[cd]ef"},
ans394{"abcabccdcdcdef"},
},
diff --git a/leetcode/0397.Integer-Replacement/397. Integer Replacement_test.go b/leetcode/0397.Integer-Replacement/397. Integer Replacement_test.go
index ffdab849..dc9ab7d3 100644
--- a/leetcode/0397.Integer-Replacement/397. Integer Replacement_test.go
+++ b/leetcode/0397.Integer-Replacement/397. Integer Replacement_test.go
@@ -26,12 +26,12 @@ func Test_Problem397(t *testing.T) {
qs := []question397{
- question397{
+ {
para397{8},
ans397{3},
},
- question397{
+ {
para397{7},
ans397{4},
},
diff --git a/leetcode/0399.Evaluate-Division/399. Evaluate Division_test.go b/leetcode/0399.Evaluate-Division/399. Evaluate Division_test.go
index 3959ce14..abbcf0af 100644
--- a/leetcode/0399.Evaluate-Division/399. Evaluate Division_test.go
+++ b/leetcode/0399.Evaluate-Division/399. Evaluate Division_test.go
@@ -28,8 +28,8 @@ func Test_Problem399(t *testing.T) {
qs := []question399{
- question399{
- para399{[][]string{[]string{"a", "b"}, []string{"b", "c"}}, []float64{2.0, 3.0}, [][]string{[]string{"a", "c"}, []string{"b", "a"}, []string{"a", "e"}, []string{"a", "a"}, []string{"x", "x"}}},
+ {
+ para399{[][]string{{"a", "b"}, {"b", "c"}}, []float64{2.0, 3.0}, [][]string{{"a", "c"}, {"b", "a"}, {"a", "e"}, {"a", "a"}, {"x", "x"}}},
ans399{[]float64{6.0, 0.5, -1.0, 1.0, -1.0}},
},
}
diff --git a/leetcode/0401.Binary-Watch/401. Binary Watch.go b/leetcode/0401.Binary-Watch/401. Binary Watch.go
index cf8c8488..cd42713a 100644
--- a/leetcode/0401.Binary-Watch/401. Binary Watch.go
+++ b/leetcode/0401.Binary-Watch/401. Binary Watch.go
@@ -9,18 +9,18 @@ var (
hour = []string{"1", "2", "4", "8"}
minute = []string{"01", "02", "04", "08", "16", "32"}
hourMap = map[int][]string{
- 0: []string{"0"},
- 1: []string{"1", "2", "4", "8"},
- 2: []string{"3", "5", "9", "6", "10"},
- 3: []string{"7", "11"},
+ 0: {"0"},
+ 1: {"1", "2", "4", "8"},
+ 2: {"3", "5", "9", "6", "10"},
+ 3: {"7", "11"},
}
minuteMap = map[int][]string{
- 0: []string{"00"},
- 1: []string{"01", "02", "04", "08", "16", "32"},
- 2: []string{"03", "05", "09", "17", "33", "06", "10", "18", "34", "12", "20", "36", "24", "40", "48"},
- 3: []string{"07", "11", "19", "35", "13", "21", "37", "25", "41", "49", "14", "22", "38", "26", "42", "50", "28", "44", "52", "56"},
- 4: []string{"15", "23", "39", "27", "43", "51", "29", "45", "53", "57", "30", "46", "54", "58"},
- 5: []string{"31", "47", "55", "59"},
+ 0: {"00"},
+ 1: {"01", "02", "04", "08", "16", "32"},
+ 2: {"03", "05", "09", "17", "33", "06", "10", "18", "34", "12", "20", "36", "24", "40", "48"},
+ 3: {"07", "11", "19", "35", "13", "21", "37", "25", "41", "49", "14", "22", "38", "26", "42", "50", "28", "44", "52", "56"},
+ 4: {"15", "23", "39", "27", "43", "51", "29", "45", "53", "57", "30", "46", "54", "58"},
+ 5: {"31", "47", "55", "59"},
}
)
diff --git a/leetcode/0401.Binary-Watch/401. Binary Watch_test.go b/leetcode/0401.Binary-Watch/401. Binary Watch_test.go
index 5eb18e8e..745cd4bb 100644
--- a/leetcode/0401.Binary-Watch/401. Binary Watch_test.go
+++ b/leetcode/0401.Binary-Watch/401. Binary Watch_test.go
@@ -26,7 +26,7 @@ func Test_Problem401(t *testing.T) {
qs := []question401{
- question401{
+ {
para401{1},
ans401{[]string{"1:00", "2:00", "4:00", "8:00", "0:01", "0:02", "0:04", "0:08", "0:16", "0:32"}},
},
diff --git a/leetcode/0402.Remove-K-Digits/402. Remove K Digits_test.go b/leetcode/0402.Remove-K-Digits/402. Remove K Digits_test.go
index 5b0b502d..f9b23418 100644
--- a/leetcode/0402.Remove-K-Digits/402. Remove K Digits_test.go
+++ b/leetcode/0402.Remove-K-Digits/402. Remove K Digits_test.go
@@ -26,42 +26,42 @@ type ans402 struct {
func Test_Problem402(t *testing.T) {
qs := []question402{
- question402{
+ {
para402{"10", 1},
ans402{"0"},
},
- question402{
+ {
para402{"1111111", 3},
ans402{"1111"},
},
- question402{
+ {
para402{"5337", 2},
ans402{"33"},
},
- question402{
+ {
para402{"112", 1},
ans402{"11"},
},
- question402{
+ {
para402{"1432219", 3},
ans402{"1219"},
},
- question402{
+ {
para402{"10200", 1},
ans402{"200"},
},
- question402{
+ {
para402{"10", 2},
ans402{"0"},
},
- question402{
+ {
para402{"19", 2},
ans402{"0"},
},
diff --git a/leetcode/0404.Sum-of-Left-Leaves/404. Sum of Left Leaves_test.go b/leetcode/0404.Sum-of-Left-Leaves/404. Sum of Left Leaves_test.go
index bdfd80bc..09a66521 100644
--- a/leetcode/0404.Sum-of-Left-Leaves/404. Sum of Left Leaves_test.go
+++ b/leetcode/0404.Sum-of-Left-Leaves/404. Sum of Left Leaves_test.go
@@ -28,12 +28,12 @@ func Test_Problem404(t *testing.T) {
qs := []question404{
- question404{
+ {
para404{[]int{}},
ans404{0},
},
- question404{
+ {
para404{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans404{24},
},
diff --git a/leetcode/0405.Convert-a-Number-to-Hexadecimal/405. Convert a Number to Hexadecimal_test.go b/leetcode/0405.Convert-a-Number-to-Hexadecimal/405. Convert a Number to Hexadecimal_test.go
index ef7c7fa5..e4aafd85 100644
--- a/leetcode/0405.Convert-a-Number-to-Hexadecimal/405. Convert a Number to Hexadecimal_test.go
+++ b/leetcode/0405.Convert-a-Number-to-Hexadecimal/405. Convert a Number to Hexadecimal_test.go
@@ -26,12 +26,12 @@ func Test_Problem405(t *testing.T) {
qs := []question405{
- question405{
+ {
para405{26},
ans405{"1a"},
},
- question405{
+ {
para405{-1},
ans405{"ffffffff"},
},
diff --git a/leetcode/0409.Longest-Palindrome/409. Longest Palindrome_test.go b/leetcode/0409.Longest-Palindrome/409. Longest Palindrome_test.go
index c6f49e73..ee023dc8 100644
--- a/leetcode/0409.Longest-Palindrome/409. Longest Palindrome_test.go
+++ b/leetcode/0409.Longest-Palindrome/409. Longest Palindrome_test.go
@@ -26,7 +26,7 @@ func Test_Problem409(t *testing.T) {
qs := []question409{
- question409{
+ {
para409{"abccccdd"},
ans409{7},
},
diff --git a/leetcode/0410.Split-Array-Largest-Sum/410. Split Array Largest Sum_test.go b/leetcode/0410.Split-Array-Largest-Sum/410. Split Array Largest Sum_test.go
index 574ca124..31e5fd05 100644
--- a/leetcode/0410.Split-Array-Largest-Sum/410. Split Array Largest Sum_test.go
+++ b/leetcode/0410.Split-Array-Largest-Sum/410. Split Array Largest Sum_test.go
@@ -27,7 +27,7 @@ func Test_Problem410(t *testing.T) {
qs := []question410{
- question410{
+ {
para410{[]int{7, 2, 5, 10, 8}, 2},
ans410{18},
},
diff --git a/leetcode/0414.Third-Maximum-Number/414. Third Maximum Number_test.go b/leetcode/0414.Third-Maximum-Number/414. Third Maximum Number_test.go
index 062cc829..522784dd 100644
--- a/leetcode/0414.Third-Maximum-Number/414. Third Maximum Number_test.go
+++ b/leetcode/0414.Third-Maximum-Number/414. Third Maximum Number_test.go
@@ -26,22 +26,22 @@ func Test_Problem414(t *testing.T) {
qs := []question414{
- question414{
+ {
para414{[]int{1, 1, 2}},
ans414{2},
},
- question414{
+ {
para414{[]int{3, 2, 1}},
ans414{1},
},
- question414{
+ {
para414{[]int{1, 2}},
ans414{2},
},
- question414{
+ {
para414{[]int{2, 2, 3, 1}},
ans414{1},
},
diff --git a/leetcode/0416.Partition-Equal-Subset-Sum/416. Partition Equal Subset Sum_test.go b/leetcode/0416.Partition-Equal-Subset-Sum/416. Partition Equal Subset Sum_test.go
index 4e26f632..fdceb0b0 100644
--- a/leetcode/0416.Partition-Equal-Subset-Sum/416. Partition Equal Subset Sum_test.go
+++ b/leetcode/0416.Partition-Equal-Subset-Sum/416. Partition Equal Subset Sum_test.go
@@ -26,17 +26,17 @@ func Test_Problem416(t *testing.T) {
qs := []question416{
- question416{
+ {
para416{[]int{1, 5, 11, 5}},
ans416{true},
},
- question416{
+ {
para416{[]int{1, 2, 3, 5}},
ans416{false},
},
- question416{
+ {
para416{[]int{1, 2, 5}},
ans416{false},
},
diff --git a/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array/421. Maximum XOR of Two Numbers in an Array_test.go b/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array/421. Maximum XOR of Two Numbers in an Array_test.go
index c7225f6f..7369f845 100644
--- a/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array/421. Maximum XOR of Two Numbers in an Array_test.go
+++ b/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array/421. Maximum XOR of Two Numbers in an Array_test.go
@@ -26,7 +26,7 @@ func Test_Problem421(t *testing.T) {
qs := []question421{
- question421{
+ {
para421{[]int{3, 10, 5, 25, 2, 8}},
ans421{28},
},
diff --git a/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement.go b/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement.go
index 7c1a0b40..8ccd0c08 100644
--- a/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement.go
+++ b/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement.go
@@ -1,8 +1,8 @@
package leetcode
func characterReplacement(s string, k int) int {
- res, left, right, counter, freq := 0, 0, 1, 0, make([]int, 26)
- for right = 0; right < len(s); right++ {
+ res, left, counter, freq := 0, 0, 0, make([]int, 26)
+ for right := 0; right < len(s); right++ {
freq[s[right]-'A']++
counter = max(counter, freq[s[right]-'A'])
for right-left+1-counter > k {
diff --git a/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement_test.go b/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement_test.go
index 2c3d5bd3..3ec26313 100644
--- a/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement_test.go
+++ b/leetcode/0424.Longest-Repeating-Character-Replacement/424. Longest Repeating Character Replacement_test.go
@@ -27,27 +27,27 @@ func Test_Problem424(t *testing.T) {
qs := []question424{
- question424{
+ {
para424{"AABABBA", 1},
ans424{4},
},
- question424{
+ {
para424{"ABBB", 2},
ans424{4},
},
- question424{
+ {
para424{"BAAA", 0},
ans424{3},
},
- question424{
+ {
para424{"ABCDE", 1},
ans424{2},
},
- question424{
+ {
para424{"BAAAB", 2},
ans424{5},
},
diff --git a/leetcode/0433.Minimum-Genetic-Mutation/433. Minimum Genetic Mutation_test.go b/leetcode/0433.Minimum-Genetic-Mutation/433. Minimum Genetic Mutation_test.go
index 0bec4713..57e7a2cb 100644
--- a/leetcode/0433.Minimum-Genetic-Mutation/433. Minimum Genetic Mutation_test.go
+++ b/leetcode/0433.Minimum-Genetic-Mutation/433. Minimum Genetic Mutation_test.go
@@ -27,22 +27,22 @@ type ans433 struct {
func Test_Problem433(t *testing.T) {
qs := []question433{
- question433{
+ {
para433{"AACCGGTT", "AACCGGTA", []string{"AACCGGTA"}},
ans433{1},
},
- question433{
+ {
para433{"AACCGGTT", "AAACGGTA", []string{"AACCGGTA", "AACCGCTA", "AAACGGTA"}},
ans433{2},
},
- question433{
+ {
para433{"AAAAACCC", "AACCCCCC", []string{"AAAACCCC", "AAACCCCC", "AACCCCCC"}},
ans433{3},
},
- question433{
+ {
para433{"AACCGGTT", "AACCGGTA", []string{}},
ans433{-1},
},
diff --git a/leetcode/0435.Non-overlapping-Intervals/435. Non-overlapping Intervals_test.go b/leetcode/0435.Non-overlapping-Intervals/435. Non-overlapping Intervals_test.go
index 3050bc8a..059a118b 100644
--- a/leetcode/0435.Non-overlapping-Intervals/435. Non-overlapping Intervals_test.go
+++ b/leetcode/0435.Non-overlapping-Intervals/435. Non-overlapping Intervals_test.go
@@ -26,18 +26,18 @@ func Test_Problem435(t *testing.T) {
qs := []question435{
- question435{
- para435{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 4}, []int{1, 3}}},
+ {
+ para435{[][]int{{1, 2}, {2, 3}, {3, 4}, {1, 3}}},
ans435{1},
},
- question435{
- para435{[][]int{[]int{1, 2}, []int{1, 2}, []int{1, 2}}},
+ {
+ para435{[][]int{{1, 2}, {1, 2}, {1, 2}}},
ans435{2},
},
- question435{
- para435{[][]int{[]int{1, 2}, []int{2, 3}}},
+ {
+ para435{[][]int{{1, 2}, {2, 3}}},
ans435{0},
},
}
diff --git a/leetcode/0436.Find-Right-Interval/436. Find Right Interval_test.go b/leetcode/0436.Find-Right-Interval/436. Find Right Interval_test.go
index 6749c448..d3d209df 100644
--- a/leetcode/0436.Find-Right-Interval/436. Find Right Interval_test.go
+++ b/leetcode/0436.Find-Right-Interval/436. Find Right Interval_test.go
@@ -26,18 +26,18 @@ func Test_Problem436(t *testing.T) {
qs := []question436{
- question436{
- para436{[][]int{[]int{3, 4}, []int{2, 3}, []int{1, 2}}},
+ {
+ para436{[][]int{{3, 4}, {2, 3}, {1, 2}}},
ans436{[]int{-1, 0, 1}},
},
- question436{
- para436{[][]int{[]int{1, 4}, []int{2, 3}, []int{3, 4}}},
+ {
+ para436{[][]int{{1, 4}, {2, 3}, {3, 4}}},
ans436{[]int{-1, 2, -1}},
},
- question436{
- para436{[][]int{[]int{1, 2}}},
+ {
+ para436{[][]int{{1, 2}}},
ans436{[]int{-1}},
},
}
diff --git a/leetcode/0437.Path-Sum-III/437. Path Sum III_test.go b/leetcode/0437.Path-Sum-III/437. Path Sum III_test.go
index 4b19a671..4f122a2d 100644
--- a/leetcode/0437.Path-Sum-III/437. Path Sum III_test.go
+++ b/leetcode/0437.Path-Sum-III/437. Path Sum III_test.go
@@ -28,12 +28,12 @@ type ans437 struct {
func Test_Problem437(t *testing.T) {
qs := []question437{
- question437{
+ {
para437{[]int{}, 0},
ans437{0},
},
- question437{
+ {
para437{[]int{10, 5, -3, 3, 2, structures.NULL, 11, 3, -2, structures.NULL, 1}, 8},
ans437{3},
},
diff --git a/leetcode/0438.Find-All-Anagrams-in-a-String/438. Find All Anagrams in a String_test.go b/leetcode/0438.Find-All-Anagrams-in-a-String/438. Find All Anagrams in a String_test.go
index 1fcd08cd..8d457e4e 100644
--- a/leetcode/0438.Find-All-Anagrams-in-a-String/438. Find All Anagrams in a String_test.go
+++ b/leetcode/0438.Find-All-Anagrams-in-a-String/438. Find All Anagrams in a String_test.go
@@ -27,22 +27,22 @@ func Test_Problem438(t *testing.T) {
qs := []question438{
- question438{
+ {
para438{"abab", "ab"},
ans438{[]int{0, 1, 2}},
},
- question438{
+ {
para438{"cbaebabacd", "abc"},
ans438{[]int{0, 6}},
},
- question438{
+ {
para438{"", "abc"},
ans438{[]int{}},
},
- question438{
+ {
para438{"abacbabc", "abc"},
ans438{[]int{1, 2, 3, 5}},
},
diff --git a/leetcode/0441.Arranging-Coins/441. Arranging Coins_test.go b/leetcode/0441.Arranging-Coins/441. Arranging Coins_test.go
index a5ac60cd..51f8403c 100644
--- a/leetcode/0441.Arranging-Coins/441. Arranging Coins_test.go
+++ b/leetcode/0441.Arranging-Coins/441. Arranging Coins_test.go
@@ -26,12 +26,12 @@ func Test_Problem441(t *testing.T) {
qs := []question441{
- question441{
+ {
para441{5},
ans441{2},
},
- question441{
+ {
para441{8},
ans441{3},
},
diff --git a/leetcode/0445.Add-Two-Numbers-II/445. Add Two Numbers II_test.go b/leetcode/0445.Add-Two-Numbers-II/445. Add Two Numbers II_test.go
index b2df6e74..fbdd48dd 100644
--- a/leetcode/0445.Add-Two-Numbers-II/445. Add Two Numbers II_test.go
+++ b/leetcode/0445.Add-Two-Numbers-II/445. Add Two Numbers II_test.go
@@ -29,42 +29,42 @@ func Test_Problem445(t *testing.T) {
qs := []question445{
- question445{
+ {
para445{[]int{}, []int{}},
ans445{[]int{}},
},
- question445{
+ {
para445{[]int{1}, []int{1}},
ans445{[]int{2}},
},
- question445{
+ {
para445{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans445{[]int{2, 4, 6, 8}},
},
- question445{
+ {
para445{[]int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5}},
ans445{[]int{2, 4, 6, 9, 0}},
},
- question445{
+ {
para445{[]int{1}, []int{9, 9, 9, 9, 9}},
ans445{[]int{1, 0, 0, 0, 0, 0}},
},
- question445{
+ {
para445{[]int{9, 9, 9, 9, 9}, []int{1}},
ans445{[]int{1, 0, 0, 0, 0, 0}},
},
- question445{
+ {
para445{[]int{2, 4, 3}, []int{5, 6, 4}},
ans445{[]int{8, 0, 7}},
},
- question445{
+ {
para445{[]int{1, 8, 3}, []int{7, 1}},
ans445{[]int{2, 5, 4}},
},
diff --git a/leetcode/0447.Number-of-Boomerangs/447. Number of Boomerangs_test.go b/leetcode/0447.Number-of-Boomerangs/447. Number of Boomerangs_test.go
index efa0c898..19e84708 100644
--- a/leetcode/0447.Number-of-Boomerangs/447. Number of Boomerangs_test.go
+++ b/leetcode/0447.Number-of-Boomerangs/447. Number of Boomerangs_test.go
@@ -26,8 +26,8 @@ func Test_Problem447(t *testing.T) {
qs := []question447{
- question447{
- para447{[][]int{[]int{0, 0}, []int{1, 0}, []int{2, 0}}},
+ {
+ para447{[][]int{{0, 0}, {1, 0}, {2, 0}}},
ans447{2},
},
diff --git a/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array/448. Find All Numbers Disappeared in an Array_test.go b/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array/448. Find All Numbers Disappeared in an Array_test.go
index db946e23..232e56bf 100644
--- a/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array/448. Find All Numbers Disappeared in an Array_test.go
+++ b/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array/448. Find All Numbers Disappeared in an Array_test.go
@@ -26,12 +26,12 @@ func Test_Problem448(t *testing.T) {
qs := []question448{
- question448{
+ {
para448{[]int{4, 3, 2, 7, 8, 2, 3, 1}},
ans448{[]int{5, 6}},
},
- question448{
+ {
para448{[]int{4, 3, 2, 10, 9, 2, 3, 1, 1, 1, 1}},
ans448{[]int{5, 6, 7, 8, 11}},
},
diff --git a/leetcode/0451.Sort-Characters-By-Frequency/451. Sort Characters By Frequency_test.go b/leetcode/0451.Sort-Characters-By-Frequency/451. Sort Characters By Frequency_test.go
index e578af16..a46b9acd 100644
--- a/leetcode/0451.Sort-Characters-By-Frequency/451. Sort Characters By Frequency_test.go
+++ b/leetcode/0451.Sort-Characters-By-Frequency/451. Sort Characters By Frequency_test.go
@@ -25,17 +25,17 @@ type ans451 struct {
func Test_Problem451(t *testing.T) {
qs := []question451{
- question451{
+ {
para451{"tree"},
ans451{"eert"},
},
- question451{
+ {
para451{"cccaaa"},
ans451{"cccaaa"},
},
- question451{
+ {
para451{"Aabb"},
ans451{"bbAa"},
},
diff --git a/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements/453. Minimum Moves to Equal Array Elements_test.go b/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements/453. Minimum Moves to Equal Array Elements_test.go
index 6a577b0f..93e37882 100644
--- a/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements/453. Minimum Moves to Equal Array Elements_test.go
+++ b/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements/453. Minimum Moves to Equal Array Elements_test.go
@@ -26,12 +26,12 @@ func Test_Problem453(t *testing.T) {
qs := []question453{
- question453{
+ {
para453{[]int{4, 3, 2, 7, 8, 2, 3, 1}},
ans453{22},
},
- question453{
+ {
para453{[]int{1, 2, 3}},
ans453{3},
},
diff --git a/leetcode/0454.4Sum-II/454. 4Sum II_test.go b/leetcode/0454.4Sum-II/454. 4Sum II_test.go
index 54fc5b42..dc567783 100644
--- a/leetcode/0454.4Sum-II/454. 4Sum II_test.go
+++ b/leetcode/0454.4Sum-II/454. 4Sum II_test.go
@@ -29,7 +29,7 @@ func Test_Problem454(t *testing.T) {
qs := []question454{
- question454{
+ {
para454{[]int{1, 2}, []int{-2, -1}, []int{-1, 2}, []int{0, 2}},
ans454{2},
},
diff --git a/leetcode/0455.Assign-Cookies/455. Assign Cookies_test.go b/leetcode/0455.Assign-Cookies/455. Assign Cookies_test.go
index e337930d..14fd09d3 100644
--- a/leetcode/0455.Assign-Cookies/455. Assign Cookies_test.go
+++ b/leetcode/0455.Assign-Cookies/455. Assign Cookies_test.go
@@ -27,12 +27,12 @@ func Test_Problem455(t *testing.T) {
qs := []question455{
- question455{
+ {
para455{[]int{1, 2, 3}, []int{1, 1}},
ans455{1},
},
- question455{
+ {
para455{[]int{1, 2}, []int{1, 2, 3}},
ans455{2},
},
diff --git a/leetcode/0456.132-Pattern/456. 132 Pattern_test.go b/leetcode/0456.132-Pattern/456. 132 Pattern_test.go
index 706bafb5..bcf7895e 100644
--- a/leetcode/0456.132-Pattern/456. 132 Pattern_test.go
+++ b/leetcode/0456.132-Pattern/456. 132 Pattern_test.go
@@ -26,27 +26,27 @@ func Test_Problem456(t *testing.T) {
qs := []question456{
- question456{
+ {
para456{[]int{}},
ans456{false},
},
- question456{
+ {
para456{[]int{1, 2, 3, 4}},
ans456{false},
},
- question456{
+ {
para456{[]int{3, 1, 4, 2}},
ans456{true},
},
- question456{
+ {
para456{[]int{-1, 3, 2, 0}},
ans456{true},
},
- question456{
+ {
para456{[]int{3, 5, 0, 3, 4}},
ans456{true},
},
diff --git a/leetcode/0457.Circular-Array-Loop/457. Circular Array Loop_test.go b/leetcode/0457.Circular-Array-Loop/457. Circular Array Loop_test.go
index 8d00c8c9..776e1f5a 100644
--- a/leetcode/0457.Circular-Array-Loop/457. Circular Array Loop_test.go
+++ b/leetcode/0457.Circular-Array-Loop/457. Circular Array Loop_test.go
@@ -26,41 +26,41 @@ func Test_Problem457(t *testing.T) {
qs := []question457{
- question457{
+ {
para457{[]int{-1}},
ans457{false},
},
- question457{
+ {
para457{[]int{3, 1, 2}},
ans457{true},
},
- question457{
+ {
para457{[]int{-8, -1, 1, 7, 2}},
ans457{false},
},
- question457{
+ {
para457{[]int{-1, -2, -3, -4, -5}},
ans457{false},
},
- question457{
+ {
para457{[]int{}},
ans457{false},
},
- question457{
+ {
para457{[]int{2, -1, 1, 2, 2}},
ans457{true},
},
- question457{
+ {
para457{[]int{-1, 2}},
ans457{false},
},
- question457{
+ {
para457{[]int{-2, 1, -1, -2, -2}},
ans457{false},
},
diff --git a/leetcode/0461.Hamming-Distance/461. Hamming Distance_test.go b/leetcode/0461.Hamming-Distance/461. Hamming Distance_test.go
index ba6a38ed..18f8395f 100644
--- a/leetcode/0461.Hamming-Distance/461. Hamming Distance_test.go
+++ b/leetcode/0461.Hamming-Distance/461. Hamming Distance_test.go
@@ -27,17 +27,17 @@ func Test_Problem461(t *testing.T) {
qs := []question461{
- question461{
+ {
para461{1, 4},
ans461{2},
},
- question461{
+ {
para461{1, 1},
ans461{0},
},
- question461{
+ {
para461{1, 3},
ans461{1},
},
diff --git a/leetcode/0463.Island-Perimeter/463. Island Perimeter_test.go b/leetcode/0463.Island-Perimeter/463. Island Perimeter_test.go
index 35dfa016..869cde43 100644
--- a/leetcode/0463.Island-Perimeter/463. Island Perimeter_test.go
+++ b/leetcode/0463.Island-Perimeter/463. Island Perimeter_test.go
@@ -26,8 +26,8 @@ func Test_Problem463(t *testing.T) {
qs := []question463{
- question463{
- para463{[][]int{[]int{0, 1, 0, 0}, []int{1, 1, 1, 0}, []int{0, 1, 0, 0}, []int{1, 1, 0, 0}}},
+ {
+ para463{[][]int{{0, 1, 0, 0}, {1, 1, 1, 0}, {0, 1, 0, 0}, {1, 1, 0, 0}}},
ans463{16},
},
}
diff --git a/leetcode/0470.Implement-Rand10-Using-Rand7/470. Implement Rand10() Using Rand7()_test.go b/leetcode/0470.Implement-Rand10-Using-Rand7/470. Implement Rand10() Using Rand7()_test.go
index 9cc1cc18..f53a88f8 100644
--- a/leetcode/0470.Implement-Rand10-Using-Rand7/470. Implement Rand10() Using Rand7()_test.go
+++ b/leetcode/0470.Implement-Rand10-Using-Rand7/470. Implement Rand10() Using Rand7()_test.go
@@ -25,17 +25,17 @@ func Test_Problem470(t *testing.T) {
qs := []question470{
- question470{
+ {
para470{},
ans470{2},
},
- question470{
+ {
para470{},
ans470{0},
},
- question470{
+ {
para470{},
ans470{1},
},
diff --git a/leetcode/0474.Ones-and-Zeroes/474. Ones and Zeroes_test.go b/leetcode/0474.Ones-and-Zeroes/474. Ones and Zeroes_test.go
index 8cfdbf72..286376ed 100644
--- a/leetcode/0474.Ones-and-Zeroes/474. Ones and Zeroes_test.go
+++ b/leetcode/0474.Ones-and-Zeroes/474. Ones and Zeroes_test.go
@@ -28,17 +28,17 @@ func Test_Problem474(t *testing.T) {
qs := []question474{
- question474{
+ {
para474{[]string{"10", "0001", "111001", "1", "0"}, 5, 3},
ans474{4},
},
- question474{
+ {
para474{[]string{"10", "0", "1"}, 1, 1},
ans474{2},
},
- question474{
+ {
para474{[]string{}, 0, 0},
ans474{0},
},
diff --git a/leetcode/0475.Heaters/475. Heaters_test.go b/leetcode/0475.Heaters/475. Heaters_test.go
index f39489ee..fffa88df 100644
--- a/leetcode/0475.Heaters/475. Heaters_test.go
+++ b/leetcode/0475.Heaters/475. Heaters_test.go
@@ -27,12 +27,12 @@ func Test_Problem475(t *testing.T) {
qs := []question475{
- question475{
+ {
para475{[]int{1, 2, 3}, []int{2}},
ans475{1},
},
- question475{
+ {
para475{[]int{1, 2, 3, 4}, []int{1, 4}},
ans475{1},
},
diff --git a/leetcode/0476.Number-Complement/476. Number Complement_test.go b/leetcode/0476.Number-Complement/476. Number Complement_test.go
index 64c33802..91c7288f 100644
--- a/leetcode/0476.Number-Complement/476. Number Complement_test.go
+++ b/leetcode/0476.Number-Complement/476. Number Complement_test.go
@@ -26,12 +26,12 @@ func Test_Problem476(t *testing.T) {
qs := []question476{
- question476{
+ {
para476{5},
ans476{2},
},
- question476{
+ {
para476{1},
ans476{0},
},
diff --git a/leetcode/0477.Total-Hamming-Distance/477. Total Hamming Distance_test.go b/leetcode/0477.Total-Hamming-Distance/477. Total Hamming Distance_test.go
index 5e69bae7..d612046a 100644
--- a/leetcode/0477.Total-Hamming-Distance/477. Total Hamming Distance_test.go
+++ b/leetcode/0477.Total-Hamming-Distance/477. Total Hamming Distance_test.go
@@ -26,7 +26,7 @@ func Test_Problem477(t *testing.T) {
qs := []question477{
- question477{
+ {
para477{[]int{4, 14, 2}},
ans477{6},
},
diff --git a/leetcode/0480.Sliding-Window-Median/480. Sliding Window Median_test.go b/leetcode/0480.Sliding-Window-Median/480. Sliding Window Median_test.go
index d5f3cfd6..fda29cce 100644
--- a/leetcode/0480.Sliding-Window-Median/480. Sliding Window Median_test.go
+++ b/leetcode/0480.Sliding-Window-Median/480. Sliding Window Median_test.go
@@ -27,7 +27,7 @@ func Test_Problem480(t *testing.T) {
qs := []question480{
- question480{
+ {
para480{[]int{1, 3, -1, -3, 5, 3, 6, 7}, 3},
ans480{[]int{1, -1, -1, 3, 5, 6}},
},
diff --git a/leetcode/0483.Smallest-Good-Base/483. Smallest Good Base_test.go b/leetcode/0483.Smallest-Good-Base/483. Smallest Good Base_test.go
index b85f1798..710548e1 100644
--- a/leetcode/0483.Smallest-Good-Base/483. Smallest Good Base_test.go
+++ b/leetcode/0483.Smallest-Good-Base/483. Smallest Good Base_test.go
@@ -26,22 +26,22 @@ func Test_Problem483(t *testing.T) {
qs := []question483{
- question483{
+ {
para483{"13"},
ans483{"3"},
},
- question483{
+ {
para483{"4681"},
ans483{"8"},
},
- question483{
+ {
para483{"1000000000000000000"},
ans483{"999999999999999999"},
},
- question483{
+ {
para483{"727004545306745403"},
ans483{"727004545306745402"},
},
diff --git a/leetcode/0485.Max-Consecutive-Ones/485. Max Consecutive Ones_test.go b/leetcode/0485.Max-Consecutive-Ones/485. Max Consecutive Ones_test.go
index 7f473b2b..6a2a69e1 100644
--- a/leetcode/0485.Max-Consecutive-Ones/485. Max Consecutive Ones_test.go
+++ b/leetcode/0485.Max-Consecutive-Ones/485. Max Consecutive Ones_test.go
@@ -26,12 +26,12 @@ func Test_Problem485(t *testing.T) {
qs := []question485{
- question485{
+ {
para485{[]int{1, 1, 0, 1, 1, 1}},
ans485{3},
},
- question485{
+ {
para485{[]int{1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1}},
ans485{4},
},
diff --git a/leetcode/0491.Increasing-Subsequences/491. Increasing Subsequences_test.go b/leetcode/0491.Increasing-Subsequences/491. Increasing Subsequences_test.go
index 18f6e742..61602a2d 100644
--- a/leetcode/0491.Increasing-Subsequences/491. Increasing Subsequences_test.go
+++ b/leetcode/0491.Increasing-Subsequences/491. Increasing Subsequences_test.go
@@ -26,14 +26,14 @@ func Test_Problem491(t *testing.T) {
qs := []question491{
- question491{
+ {
para491{[]int{4, 3, 2, 1}},
ans491{[][]int{}},
},
- question491{
+ {
para491{[]int{4, 6, 7, 7}},
- ans491{[][]int{[]int{4, 6}, []int{4, 7}, []int{4, 6, 7}, []int{4, 6, 7, 7}, []int{6, 7}, []int{6, 7, 7}, []int{7, 7}, []int{4, 7, 7}}},
+ ans491{[][]int{{4, 6}, {4, 7}, {4, 6, 7}, {4, 6, 7, 7}, {6, 7}, {6, 7, 7}, {7, 7}, {4, 7, 7}}},
},
}
diff --git a/leetcode/0493.Reverse-Pairs/493. Reverse Pairs_test.go b/leetcode/0493.Reverse-Pairs/493. Reverse Pairs_test.go
index 12866f12..49ff2de2 100644
--- a/leetcode/0493.Reverse-Pairs/493. Reverse Pairs_test.go
+++ b/leetcode/0493.Reverse-Pairs/493. Reverse Pairs_test.go
@@ -26,22 +26,22 @@ func Test_Problem493(t *testing.T) {
qs := []question493{
- question493{
+ {
para493{[]int{1, 3, 2, 3, 1}},
ans493{2},
},
- question493{
+ {
para493{[]int{2, 4, 3, 5, 1}},
ans493{3},
},
- question493{
+ {
para493{[]int{-5, -5}},
ans493{1},
},
- question493{
+ {
para493{[]int{2147483647, 2147483647, -2147483647, -2147483647, -2147483647, 2147483647}},
ans493{9},
},
diff --git a/leetcode/0494.Target-Sum/494. Target Sum_test.go b/leetcode/0494.Target-Sum/494. Target Sum_test.go
index 2fc82c9a..76700ec0 100644
--- a/leetcode/0494.Target-Sum/494. Target Sum_test.go
+++ b/leetcode/0494.Target-Sum/494. Target Sum_test.go
@@ -27,7 +27,7 @@ func Test_Problem494(t *testing.T) {
qs := []question494{
- question494{
+ {
para494{[]int{1, 1, 1, 1, 1}, 3},
ans494{5},
},
diff --git a/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I.go b/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I.go
index b1b9125b..b70becf0 100644
--- a/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I.go
+++ b/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I.go
@@ -4,12 +4,12 @@ func nextGreaterElement(nums1 []int, nums2 []int) []int {
if len(nums1) == 0 || len(nums2) == 0 {
return []int{}
}
- res, reocrd, flag := []int{}, map[int]int{}, false
+ res, reocrd := []int{}, map[int]int{}
for i, v := range nums2 {
reocrd[v] = i
}
for i := 0; i < len(nums1); i++ {
- flag = false
+ flag := false
for j := reocrd[nums1[i]]; j < len(nums2); j++ {
if nums2[j] > nums1[i] {
res = append(res, nums2[j])
diff --git a/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I_test.go b/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I_test.go
index f030ecd3..52b8bb75 100644
--- a/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I_test.go
+++ b/leetcode/0496.Next-Greater-Element-I/496. Next Greater Element I_test.go
@@ -27,12 +27,12 @@ func Test_Problem496(t *testing.T) {
qs := []question496{
- question496{
+ {
para496{[]int{4, 1, 2}, []int{1, 3, 4, 2}},
ans496{[]int{-1, 3, -1}},
},
- question496{
+ {
para496{[]int{2, 4}, []int{1, 2, 3, 4}},
ans496{[]int{3, -1}},
},
diff --git a/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles/497. Random Point in Non-overlapping Rectangles_test.go b/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles/497. Random Point in Non-overlapping Rectangles_test.go
index f0d4c4c9..766d13d0 100644
--- a/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles/497. Random Point in Non-overlapping Rectangles_test.go
+++ b/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles/497. Random Point in Non-overlapping Rectangles_test.go
@@ -6,7 +6,7 @@ import (
)
func Test_Problem497(t *testing.T) {
- w := [][]int{[]int{1, 1, 5, 5}}
+ w := [][]int{{1, 1, 5, 5}}
sol := Constructor497(w)
fmt.Printf("1.Pick = %v\n", sol.Pick())
fmt.Printf("2.Pick = %v\n", sol.Pick())
diff --git a/leetcode/0498.Diagonal-Traverse/498. Diagonal Traverse_test.go b/leetcode/0498.Diagonal-Traverse/498. Diagonal Traverse_test.go
index b78ae3ff..a0f7458e 100644
--- a/leetcode/0498.Diagonal-Traverse/498. Diagonal Traverse_test.go
+++ b/leetcode/0498.Diagonal-Traverse/498. Diagonal Traverse_test.go
@@ -26,33 +26,33 @@ func Test_Problem498(t *testing.T) {
qs := []question498{
- question498{
- para498{[][]int{[]int{3}, []int{2}, []int{9}}},
+ {
+ para498{[][]int{{3}, {2}, {9}}},
ans498{[]int{3, 2, 9}},
},
- question498{
- para498{[][]int{[]int{6, 9, 7}}},
+ {
+ para498{[][]int{{6, 9, 7}}},
ans498{[]int{6, 9, 7}},
},
- question498{
- para498{[][]int{[]int{3}, []int{2}}},
+ {
+ para498{[][]int{{3}, {2}}},
ans498{[]int{3, 2}},
},
- question498{
- para498{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}},
+ {
+ para498{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}},
ans498{[]int{1, 2, 4, 7, 5, 3, 6, 8, 9}},
},
- question498{
- para498{[][]int{[]int{0}}},
+ {
+ para498{[][]int{{0}}},
ans498{[]int{0}},
},
- question498{
- para498{[][]int{[]int{}}},
+ {
+ para498{[][]int{{}}},
ans498{[]int{}},
},
}
diff --git a/leetcode/0500.Keyboard-Row/500. Keyboard Row_test.go b/leetcode/0500.Keyboard-Row/500. Keyboard Row_test.go
index 886fa47c..d05dfefa 100644
--- a/leetcode/0500.Keyboard-Row/500. Keyboard Row_test.go
+++ b/leetcode/0500.Keyboard-Row/500. Keyboard Row_test.go
@@ -26,7 +26,7 @@ func Test_Problem500(t *testing.T) {
qs := []question500{
- question500{
+ {
para500{[]string{"Hello", "Alaska", "Dad", "Peace"}},
ans500{[]string{"Alaska", "Dad"}},
},
diff --git a/leetcode/0503.Next-Greater-Element-II/503. Next Greater Element II_test.go b/leetcode/0503.Next-Greater-Element-II/503. Next Greater Element II_test.go
index 00844b11..f4cc3cfc 100644
--- a/leetcode/0503.Next-Greater-Element-II/503. Next Greater Element II_test.go
+++ b/leetcode/0503.Next-Greater-Element-II/503. Next Greater Element II_test.go
@@ -26,17 +26,17 @@ func Test_Problem503(t *testing.T) {
qs := []question503{
- question503{
+ {
para503{[]int{}},
ans503{[]int{}},
},
- question503{
+ {
para503{[]int{1}},
ans503{[]int{-1}},
},
- question503{
+ {
para503{[]int{1, 2, 1}},
ans503{[]int{2, -1, 2}},
},
diff --git a/leetcode/0507.Perfect-Number/507. Perfect Number_test.go b/leetcode/0507.Perfect-Number/507. Perfect Number_test.go
index 20aebcbd..eb9e1306 100644
--- a/leetcode/0507.Perfect-Number/507. Perfect Number_test.go
+++ b/leetcode/0507.Perfect-Number/507. Perfect Number_test.go
@@ -26,17 +26,17 @@ func Test_Problem507(t *testing.T) {
qs := []question507{
- question507{
+ {
para507{28},
ans507{true},
},
- question507{
+ {
para507{496},
ans507{true},
},
- question507{
+ {
para507{500},
ans507{false},
},
diff --git a/leetcode/0508.Most-Frequent-Subtree-Sum/508. Most Frequent Subtree Sum_test.go b/leetcode/0508.Most-Frequent-Subtree-Sum/508. Most Frequent Subtree Sum_test.go
index abb63667..fd58a61e 100644
--- a/leetcode/0508.Most-Frequent-Subtree-Sum/508. Most Frequent Subtree Sum_test.go
+++ b/leetcode/0508.Most-Frequent-Subtree-Sum/508. Most Frequent Subtree Sum_test.go
@@ -28,27 +28,27 @@ func Test_Problem508(t *testing.T) {
qs := []question508{
- question508{
+ {
para508{[]int{}},
ans508{[]int{}},
},
- question508{
+ {
para508{[]int{1, 1}},
ans508{[]int{1, 2}},
},
- question508{
+ {
para508{[]int{1}},
ans508{[]int{1}},
},
- question508{
+ {
para508{[]int{5, 2, -3}},
ans508{[]int{2, -3, 4}},
},
- question508{
+ {
para508{[]int{5, 2, -5}},
ans508{[]int{2}},
},
diff --git a/leetcode/0509.Fibonacci-Number/509. Fibonacci Number_test.go b/leetcode/0509.Fibonacci-Number/509. Fibonacci Number_test.go
index cc7bf04c..fbbc820c 100644
--- a/leetcode/0509.Fibonacci-Number/509. Fibonacci Number_test.go
+++ b/leetcode/0509.Fibonacci-Number/509. Fibonacci Number_test.go
@@ -26,17 +26,17 @@ func Test_Problem509(t *testing.T) {
qs := []question509{
- question509{
+ {
para509{1},
ans509{1},
},
- question509{
+ {
para509{2},
ans509{1},
},
- question509{
+ {
para509{3},
ans509{2},
},
diff --git a/leetcode/0513.Find-Bottom-Left-Tree-Value/513. Find Bottom Left Tree Value_test.go b/leetcode/0513.Find-Bottom-Left-Tree-Value/513. Find Bottom Left Tree Value_test.go
index 815a42ff..73f66fe3 100644
--- a/leetcode/0513.Find-Bottom-Left-Tree-Value/513. Find Bottom Left Tree Value_test.go
+++ b/leetcode/0513.Find-Bottom-Left-Tree-Value/513. Find Bottom Left Tree Value_test.go
@@ -28,22 +28,22 @@ func Test_Problem513(t *testing.T) {
qs := []question513{
- question513{
+ {
para513{[]int{}},
ans513{0},
},
- question513{
+ {
para513{[]int{1}},
ans513{1},
},
- question513{
+ {
para513{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans513{15},
},
- question513{
+ {
para513{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
ans513{4},
},
diff --git a/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row/515. Find Largest Value in Each Tree Row_test.go b/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row/515. Find Largest Value in Each Tree Row_test.go
index 2c5a9c1c..d2847d35 100644
--- a/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row/515. Find Largest Value in Each Tree Row_test.go
+++ b/leetcode/0515.Find-Largest-Value-in-Each-Tree-Row/515. Find Largest Value in Each Tree Row_test.go
@@ -28,22 +28,22 @@ func Test_Problem515(t *testing.T) {
qs := []question515{
- question515{
+ {
para515{[]int{}},
ans515{[]int{}},
},
- question515{
+ {
para515{[]int{1}},
ans515{[]int{1}},
},
- question515{
+ {
para515{[]int{1, 3, 2, 5, 3, structures.NULL, 9}},
ans515{[]int{1, 3, 9}},
},
- question515{
+ {
para515{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans515{[]int{3, 20, 15}},
},
diff --git a/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting/524. Longest Word in Dictionary through Deleting_test.go b/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting/524. Longest Word in Dictionary through Deleting_test.go
index b67f8073..be014285 100644
--- a/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting/524. Longest Word in Dictionary through Deleting_test.go
+++ b/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting/524. Longest Word in Dictionary through Deleting_test.go
@@ -27,27 +27,27 @@ func Test_Problem524(t *testing.T) {
qs := []question524{
- question524{
+ {
para524{"abpcplea", []string{"ale", "apple", "monkey", "plea"}},
ans524{"apple"},
},
- question524{
+ {
para524{"abpcplea", []string{"a", "b", "c"}},
ans524{"a"},
},
- question524{
+ {
para524{"abpcplea", []string{"aaaaa", "b", "c"}},
ans524{"b"},
},
- question524{
+ {
para524{"bab", []string{"ba", "ab", "a", "b"}},
ans524{"ab"},
},
- question524{
+ {
para524{"aewfafwafjlwajflwajflwafj", []string{"apple", "ewaf", "awefawfwaf", "awef", "awefe", "ewafeffewafewf"}},
ans524{"ewaf"},
},
diff --git a/leetcode/0526.Beautiful-Arrangement/526. Beautiful Arrangement_test.go b/leetcode/0526.Beautiful-Arrangement/526. Beautiful Arrangement_test.go
index 2ed14c1e..b592c076 100644
--- a/leetcode/0526.Beautiful-Arrangement/526. Beautiful Arrangement_test.go
+++ b/leetcode/0526.Beautiful-Arrangement/526. Beautiful Arrangement_test.go
@@ -26,92 +26,92 @@ func Test_Problem526(t *testing.T) {
qs := []question526{
- question526{
+ {
para526{1},
ans526{1},
},
- question526{
+ {
para526{2},
ans526{2},
},
- question526{
+ {
para526{3},
ans526{3},
},
- question526{
+ {
para526{4},
ans526{8},
},
- question526{
+ {
para526{5},
ans526{10},
},
- question526{
+ {
para526{6},
ans526{36},
},
- question526{
+ {
para526{7},
ans526{41},
},
- question526{
+ {
para526{8},
ans526{132},
},
- question526{
+ {
para526{9},
ans526{250},
},
- question526{
+ {
para526{10},
ans526{700},
},
- question526{
+ {
para526{11},
ans526{750},
},
- question526{
+ {
para526{12},
ans526{4010},
},
- question526{
+ {
para526{13},
ans526{4237},
},
- question526{
+ {
para526{14},
ans526{10680},
},
- question526{
+ {
para526{15},
ans526{24679},
},
- question526{
+ {
para526{16},
ans526{87328},
},
- question526{
+ {
para526{17},
ans526{90478},
},
- question526{
+ {
para526{18},
ans526{435812},
},
diff --git a/leetcode/0529.Minesweeper/529. Minesweeper.go b/leetcode/0529.Minesweeper/529. Minesweeper.go
index f279009e..aef5d2b8 100644
--- a/leetcode/0529.Minesweeper/529. Minesweeper.go
+++ b/leetcode/0529.Minesweeper/529. Minesweeper.go
@@ -1,14 +1,14 @@
package leetcode
var dir8 = [][]int{
- []int{-1, -1},
- []int{-1, 0},
- []int{-1, 1},
- []int{0, 1},
- []int{1, 1},
- []int{1, 0},
- []int{1, -1},
- []int{0, -1},
+ {-1, -1},
+ {-1, 0},
+ {-1, 1},
+ {0, 1},
+ {1, 1},
+ {1, 0},
+ {1, -1},
+ {0, -1},
}
func updateBoard(board [][]byte, click []int) [][]byte {
diff --git a/leetcode/0529.Minesweeper/529. Minesweeper_test.go b/leetcode/0529.Minesweeper/529. Minesweeper_test.go
index 97e8fe98..7a1b538a 100644
--- a/leetcode/0529.Minesweeper/529. Minesweeper_test.go
+++ b/leetcode/0529.Minesweeper/529. Minesweeper_test.go
@@ -27,33 +27,33 @@ func Test_Problem529(t *testing.T) {
qs := []question529{
- question529{
+ {
para529{[][]byte{
- []byte{'E', 'E', 'E', 'E', 'E'},
- []byte{'E', 'E', 'M', 'E', 'E'},
- []byte{'E', 'E', 'E', 'E', 'E'},
- []byte{'E', 'E', 'E', 'E', 'E'},
+ {'E', 'E', 'E', 'E', 'E'},
+ {'E', 'E', 'M', 'E', 'E'},
+ {'E', 'E', 'E', 'E', 'E'},
+ {'E', 'E', 'E', 'E', 'E'},
}, []int{3, 0}},
ans529{[][]byte{
- []byte{'B', '1', 'E', '1', 'B'},
- []byte{'B', '1', 'M', '1', 'B'},
- []byte{'B', '1', '1', '1', 'B'},
- []byte{'B', 'B', 'B', 'B', 'B'},
+ {'B', '1', 'E', '1', 'B'},
+ {'B', '1', 'M', '1', 'B'},
+ {'B', '1', '1', '1', 'B'},
+ {'B', 'B', 'B', 'B', 'B'},
}},
},
- question529{
+ {
para529{[][]byte{
- []byte{'B', '1', 'E', '1', 'B'},
- []byte{'B', '1', 'M', '1', 'B'},
- []byte{'B', '1', '1', '1', 'B'},
- []byte{'B', 'B', 'B', 'B', 'B'},
+ {'B', '1', 'E', '1', 'B'},
+ {'B', '1', 'M', '1', 'B'},
+ {'B', '1', '1', '1', 'B'},
+ {'B', 'B', 'B', 'B', 'B'},
}, []int{1, 2}},
ans529{[][]byte{
- []byte{'B', '1', 'E', '1', 'B'},
- []byte{'B', '1', 'X', '1', 'B'},
- []byte{'B', '1', '1', '1', 'B'},
- []byte{'B', 'B', 'B', 'B', 'B'},
+ {'B', '1', 'E', '1', 'B'},
+ {'B', '1', 'X', '1', 'B'},
+ {'B', '1', '1', '1', 'B'},
+ {'B', 'B', 'B', 'B', 'B'},
}},
},
}
diff --git a/leetcode/0532.K-diff-Pairs-in-an-Array/532. K-diff Pairs in an Array_test.go b/leetcode/0532.K-diff-Pairs-in-an-Array/532. K-diff Pairs in an Array_test.go
index 2434bb68..dd895734 100644
--- a/leetcode/0532.K-diff-Pairs-in-an-Array/532. K-diff Pairs in an Array_test.go
+++ b/leetcode/0532.K-diff-Pairs-in-an-Array/532. K-diff Pairs in an Array_test.go
@@ -27,22 +27,22 @@ func Test_Problem532(t *testing.T) {
qs := []question532{
- question532{
+ {
para532{[]int{3, 1, 4, 1, 5}, 2},
ans532{2},
},
- question532{
+ {
para532{[]int{1, 2, 3, 4, 5}, 1},
ans532{4},
},
- question532{
+ {
para532{[]int{1, 3, 1, 5, 4}, 0},
ans532{1},
},
- question532{
+ {
para532{[]int{}, 3},
ans532{0},
},
diff --git a/leetcode/0537.Complex-Number-Multiplication/537. Complex Number Multiplication_test.go b/leetcode/0537.Complex-Number-Multiplication/537. Complex Number Multiplication_test.go
index 35ee1d1f..00d53dfd 100644
--- a/leetcode/0537.Complex-Number-Multiplication/537. Complex Number Multiplication_test.go
+++ b/leetcode/0537.Complex-Number-Multiplication/537. Complex Number Multiplication_test.go
@@ -27,12 +27,12 @@ func Test_Problem537(t *testing.T) {
qs := []question537{
- question537{
+ {
para537{"1+1i", "1+1i"},
ans537{"0+2i"},
},
- question537{
+ {
para537{"1+-1i", "1+-1i"},
ans537{"0+-2i"},
},
diff --git a/leetcode/0541.Reverse-String-II/541. Reverse String II_test.go b/leetcode/0541.Reverse-String-II/541. Reverse String II_test.go
index 358f0aa1..9c6d3ba5 100644
--- a/leetcode/0541.Reverse-String-II/541. Reverse String II_test.go
+++ b/leetcode/0541.Reverse-String-II/541. Reverse String II_test.go
@@ -27,22 +27,22 @@ func Test_Problem541(t *testing.T) {
qs := []question541{
- question541{
+ {
para541{"abcdefg", 2},
ans541{"bacdfeg"},
},
- question541{
+ {
para541{"abcdefg", 5},
ans541{"edcbafg"},
},
- question541{
+ {
para541{"abcd", 4},
ans541{"dcba"},
},
- question541{
+ {
para541{"", 100},
ans541{""},
},
diff --git a/leetcode/0542.01-Matrix/542. 01 Matrix_test.go b/leetcode/0542.01-Matrix/542. 01 Matrix_test.go
index efebe43b..643f4a93 100644
--- a/leetcode/0542.01-Matrix/542. 01 Matrix_test.go
+++ b/leetcode/0542.01-Matrix/542. 01 Matrix_test.go
@@ -26,19 +26,19 @@ func Test_Problem542(t *testing.T) {
qs := []question542{
- question542{
- para542{[][]int{[]int{0, 0, 0}, []int{0, 1, 0}, []int{0, 0, 0}}},
- ans542{[][]int{[]int{0, 0, 0}, []int{0, 1, 0}, []int{0, 0, 0}}},
+ {
+ para542{[][]int{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}},
+ ans542{[][]int{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}},
},
- question542{
- para542{[][]int{[]int{0, 0, 0}, []int{0, 1, 0}, []int{1, 1, 1}}},
- ans542{[][]int{[]int{0, 0, 0}, []int{0, 1, 0}, []int{1, 2, 1}}},
+ {
+ para542{[][]int{{0, 0, 0}, {0, 1, 0}, {1, 1, 1}}},
+ ans542{[][]int{{0, 0, 0}, {0, 1, 0}, {1, 2, 1}}},
},
- question542{
- para542{[][]int{[]int{1, 1, 1, 1, 1, 1}, []int{1, 1, 1, 1, 1, 1}, []int{1, 1, 0, 0, 1, 1}, []int{1, 1, 0, 0, 1, 1}, []int{1, 1, 1, 1, 1, 1}, []int{1, 1, 1, 1, 1, 1}}},
- ans542{[][]int{[]int{4, 3, 2, 2, 3, 4}, []int{3, 2, 1, 1, 2, 3}, []int{2, 1, 0, 0, 1, 2}, []int{2, 1, 0, 0, 1, 2}, []int{3, 2, 1, 1, 2, 3}, []int{4, 3, 2, 2, 3, 4}}},
+ {
+ para542{[][]int{{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1}, {1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}}},
+ ans542{[][]int{{4, 3, 2, 2, 3, 4}, {3, 2, 1, 1, 2, 3}, {2, 1, 0, 0, 1, 2}, {2, 1, 0, 0, 1, 2}, {3, 2, 1, 1, 2, 3}, {4, 3, 2, 2, 3, 4}}},
},
}
diff --git a/leetcode/0547.Friend-Circles/547. Friend Circles_test.go b/leetcode/0547.Friend-Circles/547. Friend Circles_test.go
index d481f1a0..79c4bda8 100644
--- a/leetcode/0547.Friend-Circles/547. Friend Circles_test.go
+++ b/leetcode/0547.Friend-Circles/547. Friend Circles_test.go
@@ -26,18 +26,18 @@ func Test_Problem547(t *testing.T) {
qs := []question547{
- question547{
- para547{[][]int{[]int{0, 0, 0}, []int{0, 1, 0}, []int{0, 0, 0}}},
+ {
+ para547{[][]int{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}},
ans547{3},
},
- question547{
- para547{[][]int{[]int{1, 1, 0}, []int{1, 1, 0}, []int{0, 0, 1}}},
+ {
+ para547{[][]int{{1, 1, 0}, {1, 1, 0}, {0, 0, 1}}},
ans547{2},
},
- question547{
- para547{[][]int{[]int{1, 1, 0}, []int{1, 1, 1}, []int{0, 1, 1}}},
+ {
+ para547{[][]int{{1, 1, 0}, {1, 1, 1}, {0, 1, 1}}},
ans547{1},
},
}
diff --git a/leetcode/0557.Reverse-Words-in-a-String-III/557. Reverse Words in a String III_test.go b/leetcode/0557.Reverse-Words-in-a-String-III/557. Reverse Words in a String III_test.go
index 94b9e49d..812e5e78 100644
--- a/leetcode/0557.Reverse-Words-in-a-String-III/557. Reverse Words in a String III_test.go
+++ b/leetcode/0557.Reverse-Words-in-a-String-III/557. Reverse Words in a String III_test.go
@@ -26,12 +26,12 @@ func Test_Problem557(t *testing.T) {
qs := []question557{
- question557{
+ {
para557{"Let's take LeetCode contest"},
ans557{"s'teL ekat edoCteeL tsetnoc"},
},
- question557{
+ {
para557{""},
ans557{""},
},
diff --git a/leetcode/0561.Array-Partition-I/561. Array Partition I_test.go b/leetcode/0561.Array-Partition-I/561. Array Partition I_test.go
index ca062266..967365d5 100644
--- a/leetcode/0561.Array-Partition-I/561. Array Partition I_test.go
+++ b/leetcode/0561.Array-Partition-I/561. Array Partition I_test.go
@@ -26,12 +26,12 @@ func Test_Problem561(t *testing.T) {
qs := []question561{
- question561{
+ {
para561{[]int{}},
ans561{0},
},
- question561{
+ {
para561{[]int{1, 4, 3, 2}},
ans561{4},
},
diff --git a/leetcode/0563.Binary-Tree-Tilt/563. Binary Tree Tilt_test.go b/leetcode/0563.Binary-Tree-Tilt/563. Binary Tree Tilt_test.go
index 38083886..dcf6a3bf 100644
--- a/leetcode/0563.Binary-Tree-Tilt/563. Binary Tree Tilt_test.go
+++ b/leetcode/0563.Binary-Tree-Tilt/563. Binary Tree Tilt_test.go
@@ -28,27 +28,27 @@ func Test_Problem563(t *testing.T) {
qs := []question563{
- question563{
+ {
para563{[]int{}},
ans563{0},
},
- question563{
+ {
para563{[]int{1}},
ans563{0},
},
- question563{
+ {
para563{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans563{41},
},
- question563{
+ {
para563{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
ans563{11},
},
- question563{
+ {
para563{[]int{1, 2, 3, 4, structures.NULL, 5}},
ans563{11},
},
diff --git a/leetcode/0566.Reshape-the-Matrix/566. Reshape the Matrix_test.go b/leetcode/0566.Reshape-the-Matrix/566. Reshape the Matrix_test.go
index 918ba9ec..4e33225b 100644
--- a/leetcode/0566.Reshape-the-Matrix/566. Reshape the Matrix_test.go
+++ b/leetcode/0566.Reshape-the-Matrix/566. Reshape the Matrix_test.go
@@ -28,14 +28,14 @@ func Test_Problem566(t *testing.T) {
qs := []question566{
- question566{
- para566{[][]int{[]int{1, 2}, []int{3, 4}}, 1, 4},
- ans566{[][]int{[]int{1, 2, 3, 4}}},
+ {
+ para566{[][]int{{1, 2}, {3, 4}}, 1, 4},
+ ans566{[][]int{{1, 2, 3, 4}}},
},
- question566{
- para566{[][]int{[]int{1, 2}, []int{3, 4}}, 2, 4},
- ans566{[][]int{[]int{1, 2}, []int{3, 4}}},
+ {
+ para566{[][]int{{1, 2}, {3, 4}}, 2, 4},
+ ans566{[][]int{{1, 2}, {3, 4}}},
},
}
diff --git a/leetcode/0567.Permutation-in-String/567. Permutation in String_test.go b/leetcode/0567.Permutation-in-String/567. Permutation in String_test.go
index f4c0abf9..ccef0995 100644
--- a/leetcode/0567.Permutation-in-String/567. Permutation in String_test.go
+++ b/leetcode/0567.Permutation-in-String/567. Permutation in String_test.go
@@ -27,27 +27,27 @@ func Test_Problem567(t *testing.T) {
qs := []question567{
- question567{
+ {
para567{"ab", "abab"},
ans567{true},
},
- question567{
+ {
para567{"abc", "cbaebabacd"},
ans567{true},
},
- question567{
+ {
para567{"abc", ""},
ans567{false},
},
- question567{
+ {
para567{"abc", "abacbabc"},
ans567{true},
},
- question567{
+ {
para567{"ab", "eidboaoo"},
ans567{false},
},
diff --git a/leetcode/0572.Subtree-of-Another-Tree/572. Subtree of Another Tree_test.go b/leetcode/0572.Subtree-of-Another-Tree/572. Subtree of Another Tree_test.go
index ec44000f..0270e357 100644
--- a/leetcode/0572.Subtree-of-Another-Tree/572. Subtree of Another Tree_test.go
+++ b/leetcode/0572.Subtree-of-Another-Tree/572. Subtree of Another Tree_test.go
@@ -29,22 +29,22 @@ func Test_Problem572(t *testing.T) {
qs := []question572{
- question572{
+ {
para572{[]int{}, []int{}},
ans572{true},
},
- question572{
+ {
para572{[]int{3, 4, 5, 1, 2}, []int{4, 1, 2}},
ans572{true},
},
- question572{
+ {
para572{[]int{1, 1}, []int{1}},
ans572{true},
},
- question572{
+ {
para572{[]int{1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, 2}, []int{1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, structures.NULL, 1, 2}},
ans572{true},
},
diff --git a/leetcode/0575.Distribute-Candies/575. Distribute Candies_test.go b/leetcode/0575.Distribute-Candies/575. Distribute Candies_test.go
index 1109b89c..3f223fa0 100644
--- a/leetcode/0575.Distribute-Candies/575. Distribute Candies_test.go
+++ b/leetcode/0575.Distribute-Candies/575. Distribute Candies_test.go
@@ -26,12 +26,12 @@ func Test_Problem575(t *testing.T) {
qs := []question575{
- question575{
+ {
para575{[]int{1, 1, 2, 2, 3, 3}},
ans575{3},
},
- question575{
+ {
para575{[]int{1, 1, 2, 3}},
ans575{2},
},
diff --git a/leetcode/0594.Longest-Harmonious-Subsequence/594. Longest Harmonious Subsequence_test.go b/leetcode/0594.Longest-Harmonious-Subsequence/594. Longest Harmonious Subsequence_test.go
index 29ae7f5b..3c777d0d 100644
--- a/leetcode/0594.Longest-Harmonious-Subsequence/594. Longest Harmonious Subsequence_test.go
+++ b/leetcode/0594.Longest-Harmonious-Subsequence/594. Longest Harmonious Subsequence_test.go
@@ -26,7 +26,7 @@ func Test_Problem594(t *testing.T) {
qs := []question594{
- question594{
+ {
para594{[]int{1, 3, 2, 2, 5, 2, 3, 7}},
ans594{5},
},
diff --git a/leetcode/0598.Range-Addition-II/598. Range Addition II_test.go b/leetcode/0598.Range-Addition-II/598. Range Addition II_test.go
index 0800f5f9..f7be9b0d 100644
--- a/leetcode/0598.Range-Addition-II/598. Range Addition II_test.go
+++ b/leetcode/0598.Range-Addition-II/598. Range Addition II_test.go
@@ -28,8 +28,8 @@ func Test_Problem598(t *testing.T) {
qs := []question598{
- question598{
- para598{3, 3, [][]int{[]int{2, 2}, []int{3, 3}}},
+ {
+ para598{3, 3, [][]int{{2, 2}, {3, 3}}},
ans598{4},
},
}
diff --git a/leetcode/0599.Minimum-Index-Sum-of-Two-Lists/599. Minimum Index Sum of Two Lists_test.go b/leetcode/0599.Minimum-Index-Sum-of-Two-Lists/599. Minimum Index Sum of Two Lists_test.go
index 9554de91..a702a9ce 100644
--- a/leetcode/0599.Minimum-Index-Sum-of-Two-Lists/599. Minimum Index Sum of Two Lists_test.go
+++ b/leetcode/0599.Minimum-Index-Sum-of-Two-Lists/599. Minimum Index Sum of Two Lists_test.go
@@ -27,12 +27,12 @@ func Test_Problem599(t *testing.T) {
qs := []question599{
- question599{
+ {
para599{[]string{"Shogun", "Tapioca Express", "Burger King", "KFC"}, []string{"Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"}},
ans599{[]string{"Shogun"}},
},
- question599{
+ {
para599{[]string{"Shogun", "Tapioca Express", "Burger King", "KFC"}, []string{"KFC", "Shogun", "Burger King"}},
ans599{[]string{"Shogun"}},
},
diff --git a/leetcode/0628.Maximum-Product-of-Three-Numbers/628. Maximum Product of Three Numbers_test.go b/leetcode/0628.Maximum-Product-of-Three-Numbers/628. Maximum Product of Three Numbers_test.go
index 46f04daf..a73a836d 100644
--- a/leetcode/0628.Maximum-Product-of-Three-Numbers/628. Maximum Product of Three Numbers_test.go
+++ b/leetcode/0628.Maximum-Product-of-Three-Numbers/628. Maximum Product of Three Numbers_test.go
@@ -26,47 +26,47 @@ func Test_Problem628(t *testing.T) {
qs := []question628{
- question628{
+ {
para628{[]int{3, -1, 4}},
ans628{-12},
},
- question628{
+ {
para628{[]int{1, 2}},
ans628{2},
},
- question628{
+ {
para628{[]int{1, 2, 3}},
ans628{6},
},
- question628{
+ {
para628{[]int{1, 2, 3, 4}},
ans628{24},
},
- question628{
+ {
para628{[]int{-2}},
ans628{-2},
},
- question628{
+ {
para628{[]int{0}},
ans628{0},
},
- question628{
+ {
para628{[]int{2, 3, -2, 4}},
ans628{-24},
},
- question628{
+ {
para628{[]int{-2, 0, -1}},
ans628{0},
},
- question628{
+ {
para628{[]int{-2, 0, -1, 2, 3, 1, 10}},
ans628{60},
},
diff --git a/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists/632. Smallest Range Covering Elements from K Lists_test.go b/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists/632. Smallest Range Covering Elements from K Lists_test.go
index 045b7b3f..99d40b72 100644
--- a/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists/632. Smallest Range Covering Elements from K Lists_test.go
+++ b/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists/632. Smallest Range Covering Elements from K Lists_test.go
@@ -26,8 +26,8 @@ func Test_Problem632(t *testing.T) {
qs := []question632{
- question632{
- para632{[][]int{[]int{4, 10, 15, 24, 26}, []int{0, 9, 12, 20}, []int{5, 18, 22, 30}}},
+ {
+ para632{[][]int{{4, 10, 15, 24, 26}, {0, 9, 12, 20}, {5, 18, 22, 30}}},
ans632{[]int{20, 24}},
},
}
diff --git a/leetcode/0633.Sum-of-Square-Numbers/633. Sum of Square Numbers_test.go b/leetcode/0633.Sum-of-Square-Numbers/633. Sum of Square Numbers_test.go
index aebd61c2..36a6e3d6 100644
--- a/leetcode/0633.Sum-of-Square-Numbers/633. Sum of Square Numbers_test.go
+++ b/leetcode/0633.Sum-of-Square-Numbers/633. Sum of Square Numbers_test.go
@@ -26,37 +26,37 @@ func Test_Problem633(t *testing.T) {
qs := []question633{
- question633{
+ {
para633{1},
ans633{true},
},
- question633{
+ {
para633{2},
ans633{true},
},
- question633{
+ {
para633{3},
ans633{false},
},
- question633{
+ {
para633{4},
ans633{true},
},
- question633{
+ {
para633{5},
ans633{true},
},
- question633{
+ {
para633{6},
ans633{false},
},
- question633{
+ {
para633{104976},
ans633{true},
},
diff --git a/leetcode/0636.Exclusive-Time-of-Functions/636. Exclusive Time of Functions_test.go b/leetcode/0636.Exclusive-Time-of-Functions/636. Exclusive Time of Functions_test.go
index ea9db581..63be5715 100644
--- a/leetcode/0636.Exclusive-Time-of-Functions/636. Exclusive Time of Functions_test.go
+++ b/leetcode/0636.Exclusive-Time-of-Functions/636. Exclusive Time of Functions_test.go
@@ -27,17 +27,17 @@ func Test_Problem636(t *testing.T) {
qs := []question636{
- question636{
+ {
para636{2, []string{"0:start:0", "0:start:2", "0:end:5", "1:start:7", "1:end:7", "0:end:8"}},
ans636{[]int{8, 1}},
},
- question636{
+ {
para636{2, []string{"0:start:0", "0:start:2", "0:end:5", "1:start:6", "1:end:6", "0:end:7"}},
ans636{[]int{7, 1}},
},
- question636{
+ {
para636{2, []string{"0:start:0", "1:start:2", "1:end:5", "0:end:6"}},
ans636{[]int{3, 4}},
},
diff --git a/leetcode/0637.Average-of-Levels-in-Binary-Tree/637. Average of Levels in Binary Tree_test.go b/leetcode/0637.Average-of-Levels-in-Binary-Tree/637. Average of Levels in Binary Tree_test.go
index da4bfb21..44407297 100644
--- a/leetcode/0637.Average-of-Levels-in-Binary-Tree/637. Average of Levels in Binary Tree_test.go
+++ b/leetcode/0637.Average-of-Levels-in-Binary-Tree/637. Average of Levels in Binary Tree_test.go
@@ -28,19 +28,19 @@ func Test_Problem637(t *testing.T) {
qs := []question637{
- question637{
+ {
para637{[]int{}},
ans637{[][]int{}},
},
- question637{
+ {
para637{[]int{1}},
- ans637{[][]int{[]int{1}}},
+ ans637{[][]int{{1}}},
},
- question637{
+ {
para637{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
- ans637{[][]int{[]int{3}, []int{9, 20}, []int{15, 7}}},
+ ans637{[][]int{{3}, {9, 20}, {15, 7}}},
},
}
diff --git a/leetcode/0638.Shopping-Offers/638. Shopping Offers_test.go b/leetcode/0638.Shopping-Offers/638. Shopping Offers_test.go
index 5ac44d3a..1bbd3ba1 100644
--- a/leetcode/0638.Shopping-Offers/638. Shopping Offers_test.go
+++ b/leetcode/0638.Shopping-Offers/638. Shopping Offers_test.go
@@ -28,13 +28,13 @@ func Test_Problem638(t *testing.T) {
qs := []question638{
- question638{
- para638{[]int{2, 5}, [][]int{[]int{3, 0, 5}, []int{1, 2, 10}}, []int{3, 2}},
+ {
+ para638{[]int{2, 5}, [][]int{{3, 0, 5}, {1, 2, 10}}, []int{3, 2}},
ans638{14},
},
- question638{
- para638{[]int{2, 3, 4}, [][]int{[]int{1, 1, 0, 4}, []int{2, 2, 1, 9}}, []int{1, 2, 1}},
+ {
+ para638{[]int{2, 3, 4}, [][]int{{1, 1, 0, 4}, {2, 2, 1, 9}}, []int{1, 2, 1}},
ans638{11},
},
}
diff --git a/leetcode/0645.Set-Mismatch/645. Set Mismatch_test.go b/leetcode/0645.Set-Mismatch/645. Set Mismatch_test.go
index da842d64..2c28b43a 100644
--- a/leetcode/0645.Set-Mismatch/645. Set Mismatch_test.go
+++ b/leetcode/0645.Set-Mismatch/645. Set Mismatch_test.go
@@ -26,7 +26,7 @@ func Test_Problem645(t *testing.T) {
qs := []question645{
- question645{
+ {
para645{[]int{1, 2, 2, 4}},
ans645{[]int{2, 3}},
},
diff --git a/leetcode/0648.Replace-Words/648. Replace Words_test.go b/leetcode/0648.Replace-Words/648. Replace Words_test.go
index f9272e0e..998ae06c 100644
--- a/leetcode/0648.Replace-Words/648. Replace Words_test.go
+++ b/leetcode/0648.Replace-Words/648. Replace Words_test.go
@@ -27,7 +27,7 @@ func Test_Problem648(t *testing.T) {
qs := []question648{
- question648{
+ {
para648{[]string{"cat", "bat", "rat"}, "the cattle was rattled by the battery"},
ans648{"the cat was rat by the bat"},
},
diff --git a/leetcode/0653.Two-Sum-IV---Input-is-a-BST/653. Two Sum IV - Input is a BST_test.go b/leetcode/0653.Two-Sum-IV---Input-is-a-BST/653. Two Sum IV - Input is a BST_test.go
index dd82f53d..ced539c9 100644
--- a/leetcode/0653.Two-Sum-IV---Input-is-a-BST/653. Two Sum IV - Input is a BST_test.go
+++ b/leetcode/0653.Two-Sum-IV---Input-is-a-BST/653. Two Sum IV - Input is a BST_test.go
@@ -29,22 +29,22 @@ func Test_Problem653(t *testing.T) {
qs := []question653{
- question653{
+ {
para653{[]int{}, 0},
ans653{false},
},
- question653{
+ {
para653{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}, 29},
ans653{true},
},
- question653{
+ {
para653{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}, 9},
ans653{true},
},
- question653{
+ {
para653{[]int{1, 2, 3, 4, structures.NULL, 5}, 4},
ans653{true},
},
diff --git a/leetcode/0658.Find-K-Closest-Elements/658. Find K Closest Elements_test.go b/leetcode/0658.Find-K-Closest-Elements/658. Find K Closest Elements_test.go
index ce6775ec..790d515e 100644
--- a/leetcode/0658.Find-K-Closest-Elements/658. Find K Closest Elements_test.go
+++ b/leetcode/0658.Find-K-Closest-Elements/658. Find K Closest Elements_test.go
@@ -28,12 +28,12 @@ func Test_Problem658(t *testing.T) {
qs := []question658{
- question658{
+ {
para658{[]int{1, 2, 3, 4, 5}, 4, 3},
ans658{[]int{1, 2, 3, 4}},
},
- question658{
+ {
para658{[]int{1, 2, 3, 4, 5}, 4, -1},
ans658{[]int{1, 2, 3, 4}},
},
diff --git a/leetcode/0661.Image-Smoother/661. Image Smoother_test.go b/leetcode/0661.Image-Smoother/661. Image Smoother_test.go
index f15ecdfd..0fa3a52f 100644
--- a/leetcode/0661.Image-Smoother/661. Image Smoother_test.go
+++ b/leetcode/0661.Image-Smoother/661. Image Smoother_test.go
@@ -26,19 +26,19 @@ func Test_Problem661(t *testing.T) {
qs := []question661{
- question661{
- para661{[][]int{[]int{1, 1, 1}, []int{1, 1, 2}}},
- ans661{[][]int{[]int{1, 1, 1}, []int{1, 1, 1}}},
+ {
+ para661{[][]int{{1, 1, 1}, {1, 1, 2}}},
+ ans661{[][]int{{1, 1, 1}, {1, 1, 1}}},
},
- question661{
- para661{[][]int{[]int{1, 1, 1}, []int{1, 1, 2}, []int{1, 1, 1}}},
- ans661{[][]int{[]int{1, 1, 1}, []int{1, 1, 1}, []int{1, 1, 1}}},
+ {
+ para661{[][]int{{1, 1, 1}, {1, 1, 2}, {1, 1, 1}}},
+ ans661{[][]int{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}},
},
- question661{
- para661{[][]int{[]int{1, 1, 1}, []int{1, 0, 1}, []int{1, 1, 1}}},
- ans661{[][]int{[]int{0, 0, 0}, []int{0, 0, 0}, []int{0, 0, 0}}},
+ {
+ para661{[][]int{{1, 1, 1}, {1, 0, 1}, {1, 1, 1}}},
+ ans661{[][]int{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
},
}
diff --git a/leetcode/0662.Maximum-Width-of-Binary-Tree/662. Maximum Width of Binary Tree_test.go b/leetcode/0662.Maximum-Width-of-Binary-Tree/662. Maximum Width of Binary Tree_test.go
index a4b49d0a..decdffcb 100644
--- a/leetcode/0662.Maximum-Width-of-Binary-Tree/662. Maximum Width of Binary Tree_test.go
+++ b/leetcode/0662.Maximum-Width-of-Binary-Tree/662. Maximum Width of Binary Tree_test.go
@@ -28,27 +28,27 @@ func Test_Problem662(t *testing.T) {
qs := []question662{
- question662{
+ {
para662{[]int{1, 1, 1, 1, 1, 1, 1, structures.NULL, structures.NULL, structures.NULL, 1, structures.NULL, structures.NULL, structures.NULL, structures.NULL, 2, 2, 2, 2, 2, 2, 2, structures.NULL, 2, structures.NULL, structures.NULL, 2, structures.NULL, 2}},
ans662{8},
},
- question662{
+ {
para662{[]int{1, 1, 1, 1, structures.NULL, structures.NULL, 1, 1, structures.NULL, structures.NULL, 1}},
ans662{8},
},
- question662{
+ {
para662{[]int{}},
ans662{0},
},
- question662{
+ {
para662{[]int{1}},
ans662{1},
},
- question662{
+ {
para662{[]int{1, 3, 2, 5, 3, structures.NULL, 9}},
ans662{4},
},
diff --git a/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table/668. Kth Smallest Number in Multiplication Table_test.go b/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table/668. Kth Smallest Number in Multiplication Table_test.go
index 8285b611..7be66235 100644
--- a/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table/668. Kth Smallest Number in Multiplication Table_test.go
+++ b/leetcode/0668.Kth-Smallest-Number-in-Multiplication-Table/668. Kth Smallest Number in Multiplication Table_test.go
@@ -28,27 +28,27 @@ func Test_Problem668(t *testing.T) {
qs := []question668{
- question668{
+ {
para668{3, 3, 5},
ans668{3},
},
- question668{
+ {
para668{2, 3, 6},
ans668{6},
},
- question668{
+ {
para668{1, 3, 2},
ans668{2},
},
- question668{
+ {
para668{42, 34, 401},
ans668{126},
},
- question668{
+ {
para668{7341, 13535, 12330027},
ans668{2673783},
},
diff --git a/leetcode/0682.Baseball-Game/682. Baseball Game_test.go b/leetcode/0682.Baseball-Game/682. Baseball Game_test.go
index a5dac7d8..ce271aca 100644
--- a/leetcode/0682.Baseball-Game/682. Baseball Game_test.go
+++ b/leetcode/0682.Baseball-Game/682. Baseball Game_test.go
@@ -26,12 +26,12 @@ func Test_Problem682(t *testing.T) {
qs := []question682{
- question682{
+ {
para682{[]string{"5", "2", "C", "D", "+"}},
ans682{30},
},
- question682{
+ {
para682{[]string{"5", "-2", "4", "C", "D", "9", "+", "+"}},
ans682{27},
},
diff --git a/leetcode/0684.Redundant-Connection/684. Redundant Connection_test.go b/leetcode/0684.Redundant-Connection/684. Redundant Connection_test.go
index 2e30735d..f5e2f711 100644
--- a/leetcode/0684.Redundant-Connection/684. Redundant Connection_test.go
+++ b/leetcode/0684.Redundant-Connection/684. Redundant Connection_test.go
@@ -26,13 +26,13 @@ func Test_Problem684(t *testing.T) {
qs := []question684{
- question684{
- para684{[][]int{[]int{1, 2}, []int{1, 3}, []int{2, 3}}},
+ {
+ para684{[][]int{{1, 2}, {1, 3}, {2, 3}}},
ans684{[]int{2, 3}},
},
- question684{
- para684{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 4}, []int{1, 4}, []int{1, 5}}},
+ {
+ para684{[][]int{{1, 2}, {2, 3}, {3, 4}, {1, 4}, {1, 5}}},
ans684{[]int{1, 4}},
},
}
diff --git a/leetcode/0685.Redundant-Connection-II/685. Redundant Connection II_test.go b/leetcode/0685.Redundant-Connection-II/685. Redundant Connection II_test.go
index 96a4ff22..4abb94ea 100644
--- a/leetcode/0685.Redundant-Connection-II/685. Redundant Connection II_test.go
+++ b/leetcode/0685.Redundant-Connection-II/685. Redundant Connection II_test.go
@@ -26,28 +26,28 @@ func Test_Problem685(t *testing.T) {
qs := []question685{
- question685{
- para685{[][]int{[]int{3, 5}, []int{1, 3}, []int{2, 1}, []int{5, 4}, []int{2, 3}}},
+ {
+ para685{[][]int{{3, 5}, {1, 3}, {2, 1}, {5, 4}, {2, 3}}},
ans685{[]int{2, 3}},
},
- question685{
- para685{[][]int{[]int{4, 2}, []int{1, 5}, []int{5, 2}, []int{5, 3}, []int{2, 4}}},
+ {
+ para685{[][]int{{4, 2}, {1, 5}, {5, 2}, {5, 3}, {2, 4}}},
ans685{[]int{4, 2}},
},
- question685{
- para685{[][]int{[]int{1, 2}, []int{1, 3}, []int{2, 3}}},
+ {
+ para685{[][]int{{1, 2}, {1, 3}, {2, 3}}},
ans685{[]int{2, 3}},
},
- question685{
- para685{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 4}, []int{1, 4}, []int{1, 5}}},
+ {
+ para685{[][]int{{1, 2}, {2, 3}, {3, 4}, {1, 4}, {1, 5}}},
ans685{[]int{1, 4}},
},
- question685{
- para685{[][]int{[]int{2, 1}, []int{3, 1}, []int{4, 2}, []int{1, 4}}},
+ {
+ para685{[][]int{{2, 1}, {3, 1}, {4, 2}, {1, 4}}},
ans685{[]int{2, 1}},
},
}
diff --git a/leetcode/0693.Binary-Number-with-Alternating-Bits/693. Binary Number with Alternating Bits_test.go b/leetcode/0693.Binary-Number-with-Alternating-Bits/693. Binary Number with Alternating Bits_test.go
index 321e3ca2..40a10bb2 100644
--- a/leetcode/0693.Binary-Number-with-Alternating-Bits/693. Binary Number with Alternating Bits_test.go
+++ b/leetcode/0693.Binary-Number-with-Alternating-Bits/693. Binary Number with Alternating Bits_test.go
@@ -26,22 +26,22 @@ func Test_Problem693(t *testing.T) {
qs := []question693{
- question693{
+ {
para693{5},
ans693{true},
},
- question693{
+ {
para693{7},
ans693{false},
},
- question693{
+ {
para693{11},
ans693{false},
},
- question693{
+ {
para693{10},
ans693{true},
},
diff --git a/leetcode/0695.Max-Area-of-Island/695. Max Area of Island.go b/leetcode/0695.Max-Area-of-Island/695. Max Area of Island.go
index 2f372dbc..d19c7fd7 100644
--- a/leetcode/0695.Max-Area-of-Island/695. Max Area of Island.go
+++ b/leetcode/0695.Max-Area-of-Island/695. Max Area of Island.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func maxAreaOfIsland(grid [][]int) int {
diff --git a/leetcode/0695.Max-Area-of-Island/695. Max Area of Island_test.go b/leetcode/0695.Max-Area-of-Island/695. Max Area of Island_test.go
index f7373b55..9bfea727 100644
--- a/leetcode/0695.Max-Area-of-Island/695. Max Area of Island_test.go
+++ b/leetcode/0695.Max-Area-of-Island/695. Max Area of Island_test.go
@@ -26,55 +26,55 @@ func Test_Problem695(t *testing.T) {
qs := []question695{
- question695{
+ {
para695{[][]int{
- []int{1, 1, 1, 1, 0},
- []int{1, 1, 0, 1, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 0, 0, 0},
+ {1, 1, 1, 1, 0},
+ {1, 1, 0, 1, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 0, 0, 0},
}},
ans695{9},
},
- question695{
+ {
para695{[][]int{
- []int{1, 1, 0, 0, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 1, 0, 0},
- []int{0, 0, 0, 1, 1},
+ {1, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 1, 0, 0},
+ {0, 0, 0, 1, 1},
}},
ans695{4},
},
- question695{
+ {
para695{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 1, 0},
- []int{1, 0, 1, 0, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 1, 0},
+ {1, 0, 1, 0, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1, 0},
}},
ans695{23},
},
- question695{
+ {
para695{[][]int{
- []int{0, 0, 1, 0, 0},
- []int{0, 1, 0, 1, 0},
- []int{0, 1, 1, 1, 0},
+ {0, 0, 1, 0, 0},
+ {0, 1, 0, 1, 0},
+ {0, 1, 1, 1, 0},
}},
ans695{5},
},
- question695{
+ {
para695{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 1, 0, 1, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 1, 0, 1, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1},
}},
ans695{24},
},
diff --git a/leetcode/0697.Degree-of-an-Array/697. Degree of an Array_test.go b/leetcode/0697.Degree-of-an-Array/697. Degree of an Array_test.go
index 57eb6c32..4f073002 100644
--- a/leetcode/0697.Degree-of-an-Array/697. Degree of an Array_test.go
+++ b/leetcode/0697.Degree-of-an-Array/697. Degree of an Array_test.go
@@ -26,27 +26,27 @@ func Test_Problem697(t *testing.T) {
qs := []question697{
- question697{
+ {
para697{[]int{1, 2, 2, 3, 1}},
ans697{2},
},
- question697{
+ {
para697{[]int{1, 2, 2, 3, 1, 4, 2}},
ans697{6},
},
- question697{
+ {
para697{[]int{}},
ans697{0},
},
- question697{
+ {
para697{[]int{1, 1, 1, 1, 1}},
ans697{5},
},
- question697{
+ {
para697{[]int{1, 2, 2, 3, 1, 4, 2, 1, 2, 2, 3, 1, 4, 2}},
ans697{13},
},
diff --git a/leetcode/0699.Falling-Squares/699. Falling Squares_test.go b/leetcode/0699.Falling-Squares/699. Falling Squares_test.go
index 7089d7e8..54e5aaea 100644
--- a/leetcode/0699.Falling-Squares/699. Falling Squares_test.go
+++ b/leetcode/0699.Falling-Squares/699. Falling Squares_test.go
@@ -26,23 +26,23 @@ func Test_Problem699(t *testing.T) {
qs := []question699{
- question699{
- para699{[][]int{[]int{6, 1}, []int{9, 2}, []int{2, 4}}},
+ {
+ para699{[][]int{{6, 1}, {9, 2}, {2, 4}}},
ans699{[]int{1, 2, 4}},
},
- question699{
- para699{[][]int{[]int{1, 2}, []int{1, 3}}},
+ {
+ para699{[][]int{{1, 2}, {1, 3}}},
ans699{[]int{2, 5}},
},
- question699{
- para699{[][]int{[]int{1, 2}, []int{2, 3}, []int{6, 1}}},
+ {
+ para699{[][]int{{1, 2}, {2, 3}, {6, 1}}},
ans699{[]int{2, 5, 5}},
},
- question699{
- para699{[][]int{[]int{100, 100}, []int{200, 100}}},
+ {
+ para699{[][]int{{100, 100}, {200, 100}}},
ans699{[]int{100, 100}},
},
}
diff --git a/leetcode/0704.Binary-Search/704. Binary Search_test.go b/leetcode/0704.Binary-Search/704. Binary Search_test.go
index 85c06368..594327f2 100644
--- a/leetcode/0704.Binary-Search/704. Binary Search_test.go
+++ b/leetcode/0704.Binary-Search/704. Binary Search_test.go
@@ -27,12 +27,12 @@ func Test_Problem704(t *testing.T) {
qs := []question704{
- question704{
+ {
para704{[]int{-1, 0, 3, 5, 9, 12}, 9},
ans704{4},
},
- question704{
+ {
para704{[]int{-1, 0, 3, 5, 9, 12}, 2},
ans704{-1},
},
diff --git a/leetcode/0710.Random-Pick-with-Blacklist/710. Random Pick with Blacklist_test.go b/leetcode/0710.Random-Pick-with-Blacklist/710. Random Pick with Blacklist_test.go
index a1732ae4..ca633159 100644
--- a/leetcode/0710.Random-Pick-with-Blacklist/710. Random Pick with Blacklist_test.go
+++ b/leetcode/0710.Random-Pick-with-Blacklist/710. Random Pick with Blacklist_test.go
@@ -28,27 +28,27 @@ func Test_Problem710(t *testing.T) {
qs := []question710{
- question710{
+ {
para710{1, []int{}, 3},
ans710{[]int{0, 0, 0}},
},
- question710{
+ {
para710{2, []int{}, 3},
ans710{[]int{1, 1, 1}},
},
- question710{
+ {
para710{3, []int{1}, 3},
ans710{[]int{0, 0, 2}},
},
- question710{
+ {
para710{4, []int{2}, 3},
ans710{[]int{1, 3, 1}},
},
- question710{
+ {
para710{10000000, []int{1, 9999, 999999, 99999, 100, 0}, 10},
ans710{[]int{400, 200, 300}},
},
diff --git a/leetcode/0713.Subarray-Product-Less-Than-K/713. Subarray Product Less Than K_test.go b/leetcode/0713.Subarray-Product-Less-Than-K/713. Subarray Product Less Than K_test.go
index 5d879eb6..c6f8c865 100644
--- a/leetcode/0713.Subarray-Product-Less-Than-K/713. Subarray Product Less Than K_test.go
+++ b/leetcode/0713.Subarray-Product-Less-Than-K/713. Subarray Product Less Than K_test.go
@@ -27,12 +27,12 @@ func Test_Problem713(t *testing.T) {
qs := []question713{
- question713{
+ {
para713{[]int{10, 5, 2, 6}, 100},
ans713{8},
},
- question713{
+ {
para713{[]int{10, 9, 10, 4, 3, 8, 3, 3, 6, 2, 10, 10, 9, 3}, 19},
ans713{18},
},
diff --git a/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/714. Best Time to Buy and Sell Stock with Transaction Fee_test.go b/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/714. Best Time to Buy and Sell Stock with Transaction Fee_test.go
index 3bcdce3a..75c667b4 100644
--- a/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/714. Best Time to Buy and Sell Stock with Transaction Fee_test.go
+++ b/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/714. Best Time to Buy and Sell Stock with Transaction Fee_test.go
@@ -27,22 +27,22 @@ func Test_Problem714(t *testing.T) {
qs := []question714{
- question714{
+ {
para714{[]int{}, 0},
ans714{0},
},
- question714{
+ {
para714{[]int{7, 1, 5, 3, 6, 4}, 0},
ans714{7},
},
- question714{
+ {
para714{[]int{7, 6, 4, 3, 1}, 0},
ans714{0},
},
- question714{
+ {
para714{[]int{1, 3, 2, 8, 4, 9}, 2},
ans714{8},
},
diff --git a/leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters_test.go b/leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters_test.go
index ae26f48c..20228cc9 100644
--- a/leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters_test.go
+++ b/leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters_test.go
@@ -26,22 +26,22 @@ func Test_Problem717(t *testing.T) {
qs := []question717{
- question717{
+ {
para717{[]int{1, 0, 0}},
ans717{true},
},
- question717{
+ {
para717{[]int{1, 1, 1, 0}},
ans717{false},
},
- question717{
+ {
para717{[]int{0, 1, 1, 1, 0, 0}},
ans717{true},
},
- question717{
+ {
para717{[]int{1, 1, 1, 1, 0}},
ans717{true},
},
diff --git a/leetcode/0718.Maximum-Length-of-Repeated-Subarray/718. Maximum Length of Repeated Subarray_test.go b/leetcode/0718.Maximum-Length-of-Repeated-Subarray/718. Maximum Length of Repeated Subarray_test.go
index 60bdddc2..37ec1a04 100644
--- a/leetcode/0718.Maximum-Length-of-Repeated-Subarray/718. Maximum Length of Repeated Subarray_test.go
+++ b/leetcode/0718.Maximum-Length-of-Repeated-Subarray/718. Maximum Length of Repeated Subarray_test.go
@@ -27,22 +27,22 @@ func Test_Problem718(t *testing.T) {
qs := []question718{
- question718{
+ {
para718{[]int{0, 0, 0, 0, 0}, []int{0, 0, 0, 0, 0}},
ans718{5},
},
- question718{
+ {
para718{[]int{1, 2, 3, 2, 1}, []int{3, 2, 1, 4, 7}},
ans718{3},
},
- question718{
+ {
para718{[]int{0, 0, 0, 0, 1}, []int{1, 0, 0, 0, 0}},
ans718{4},
},
- question718{
+ {
para718{[]int{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, []int{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}},
ans718{59},
},
diff --git a/leetcode/0719.Find-K-th-Smallest-Pair-Distance/719. Find K-th Smallest Pair Distance_test.go b/leetcode/0719.Find-K-th-Smallest-Pair-Distance/719. Find K-th Smallest Pair Distance_test.go
index 96885cd8..cf9ff58d 100644
--- a/leetcode/0719.Find-K-th-Smallest-Pair-Distance/719. Find K-th Smallest Pair Distance_test.go
+++ b/leetcode/0719.Find-K-th-Smallest-Pair-Distance/719. Find K-th Smallest Pair Distance_test.go
@@ -27,27 +27,27 @@ func Test_Problem719(t *testing.T) {
qs := []question719{
- question719{
+ {
para719{[]int{1, 3, 1}, 1},
ans719{0},
},
- question719{
+ {
para719{[]int{1, 1, 1}, 2},
ans719{0},
},
- question719{
+ {
para719{[]int{1, 6, 1}, 3},
ans719{5},
},
- question719{
+ {
para719{[]int{62, 100, 4}, 2},
ans719{58},
},
- question719{
+ {
para719{[]int{9, 10, 7, 10, 6, 1, 5, 4, 9, 8}, 18},
ans719{2},
},
diff --git a/leetcode/0720.Longest-Word-in-Dictionary/720. Longest Word in Dictionary_test.go b/leetcode/0720.Longest-Word-in-Dictionary/720. Longest Word in Dictionary_test.go
index b018bcfa..0e63bb59 100644
--- a/leetcode/0720.Longest-Word-in-Dictionary/720. Longest Word in Dictionary_test.go
+++ b/leetcode/0720.Longest-Word-in-Dictionary/720. Longest Word in Dictionary_test.go
@@ -26,12 +26,12 @@ func Test_Problem720(t *testing.T) {
qs := []question720{
- question720{
+ {
para720{[]string{"w", "wo", "wor", "worl", "world"}},
ans720{"world"},
},
- question720{
+ {
para720{[]string{"a", "banana", "app", "appl", "ap", "apply", "apple"}},
ans720{"apple"},
},
diff --git a/leetcode/0721.Accounts-Merge/721. Accounts Merge_test.go b/leetcode/0721.Accounts-Merge/721. Accounts Merge_test.go
index d0dd8bcd..40ed580d 100644
--- a/leetcode/0721.Accounts-Merge/721. Accounts Merge_test.go
+++ b/leetcode/0721.Accounts-Merge/721. Accounts Merge_test.go
@@ -26,38 +26,38 @@ func Test_Problem721(t *testing.T) {
qs := []question721{
- question721{
- para721{[][]string{[]string{"John", "johnsmith@mail.com", "john00@mail.com"},
- []string{"John", "johnnybravo@mail.com"},
- []string{"John", "johnsmith@mail.com", "john_newyork@mail.com"},
- []string{"Mary", "mary@mail.com"}}},
- ans721{[][]string{[]string{"John", "john00@mail.com", "john_newyork@mail.com", "johnsmith@mail.com"},
- []string{"John", "johnnybravo@mail.com"},
- []string{"Mary", "mary@mail.com"}}},
+ {
+ para721{[][]string{{"John", "johnsmith@mail.com", "john00@mail.com"},
+ {"John", "johnnybravo@mail.com"},
+ {"John", "johnsmith@mail.com", "john_newyork@mail.com"},
+ {"Mary", "mary@mail.com"}}},
+ ans721{[][]string{{"John", "john00@mail.com", "john_newyork@mail.com", "johnsmith@mail.com"},
+ {"John", "johnnybravo@mail.com"},
+ {"Mary", "mary@mail.com"}}},
},
- question721{
- para721{[][]string{[]string{"Alex", "Alex5@m.co", "Alex4@m.co", "Alex0@m.co"},
- []string{"Ethan", "Ethan3@m.co", "Ethan3@m.co", "Ethan0@m.co"},
- []string{"Kevin", "Kevin4@m.co", "Kevin2@m.co", "Kevin2@m.co"},
- []string{"Gabe", "Gabe0@m.co", "Gabe3@m.co", "Gabe2@m.co"},
- []string{"Gabe", "Gabe3@m.co", "Gabe4@m.co", "Gabe2@m.co"}}},
- ans721{[][]string{[]string{"Alex", "Alex0@m.co", "Alex4@m.co", "Alex5@m.co"},
- []string{"Ethan", "Ethan0@m.co", "Ethan3@m.co"},
- []string{"Gabe", "Gabe0@m.co", "Gabe2@m.co", "Gabe3@m.co", "Gabe4@m.co"},
- []string{"Kevin", "Kevin2@m.co", "Kevin4@m.co"}}},
+ {
+ para721{[][]string{{"Alex", "Alex5@m.co", "Alex4@m.co", "Alex0@m.co"},
+ {"Ethan", "Ethan3@m.co", "Ethan3@m.co", "Ethan0@m.co"},
+ {"Kevin", "Kevin4@m.co", "Kevin2@m.co", "Kevin2@m.co"},
+ {"Gabe", "Gabe0@m.co", "Gabe3@m.co", "Gabe2@m.co"},
+ {"Gabe", "Gabe3@m.co", "Gabe4@m.co", "Gabe2@m.co"}}},
+ ans721{[][]string{{"Alex", "Alex0@m.co", "Alex4@m.co", "Alex5@m.co"},
+ {"Ethan", "Ethan0@m.co", "Ethan3@m.co"},
+ {"Gabe", "Gabe0@m.co", "Gabe2@m.co", "Gabe3@m.co", "Gabe4@m.co"},
+ {"Kevin", "Kevin2@m.co", "Kevin4@m.co"}}},
},
- question721{
- para721{[][]string{[]string{"David", "David0@m.co", "David4@m.co", "David3@m.co"},
- []string{"David", "David5@m.co", "David5@m.co", "David0@m.co"},
- []string{"David", "David1@m.co", "David4@m.co", "David0@m.co"},
- []string{"David", "David0@m.co", "David1@m.co", "David3@m.co"},
- []string{"David", "David4@m.co", "David1@m.co", "David3@m.co"}}},
- ans721{[][]string{[]string{"David", "David0@m.co", "David1@m.co", "David3@m.co", "David4@m.co", "David5@m.co"}}},
+ {
+ para721{[][]string{{"David", "David0@m.co", "David4@m.co", "David3@m.co"},
+ {"David", "David5@m.co", "David5@m.co", "David0@m.co"},
+ {"David", "David1@m.co", "David4@m.co", "David0@m.co"},
+ {"David", "David0@m.co", "David1@m.co", "David3@m.co"},
+ {"David", "David4@m.co", "David1@m.co", "David3@m.co"}}},
+ ans721{[][]string{{"David", "David0@m.co", "David1@m.co", "David3@m.co", "David4@m.co", "David5@m.co"}}},
},
- question721{
+ {
para721{[][]string{}},
ans721{[][]string{}},
},
diff --git a/leetcode/0724.Find-Pivot-Index/724. Find Pivot Index_test.go b/leetcode/0724.Find-Pivot-Index/724. Find Pivot Index_test.go
index f1ed6fd4..6c89385a 100644
--- a/leetcode/0724.Find-Pivot-Index/724. Find Pivot Index_test.go
+++ b/leetcode/0724.Find-Pivot-Index/724. Find Pivot Index_test.go
@@ -26,32 +26,32 @@ func Test_Problem724(t *testing.T) {
qs := []question724{
- question724{
+ {
para724{[]int{1, 7, 3, 6, 5, 6}},
ans724{3},
},
- question724{
+ {
para724{[]int{1, 2, 3}},
ans724{-1},
},
- question724{
+ {
para724{[]int{-1, -1, -1, -1, -1, -1}},
ans724{-1},
},
- question724{
+ {
para724{[]int{-1, -1, -1, -1, -1, 0}},
ans724{2},
},
- question724{
+ {
para724{[]int{1}},
ans724{0},
},
- question724{
+ {
para724{[]int{}},
ans724{-1},
},
diff --git a/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts.go b/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts.go
index 167b4ae9..9a17de21 100644
--- a/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts.go
+++ b/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts.go
@@ -27,9 +27,8 @@ func splitListToParts(root *ListNode, k int) []*ListNode {
length := getLength(root)
splitNum := length / k
lengNum := length % k
- cur := root
- head := root
- pre := root
+ cur, head := root, root
+ var pre *ListNode
fmt.Printf("总长度 %v, 分 %v 组, 前面 %v 组长度为 %v, 剩余 %v 组,每组 %v\n", length, k, lengNum, splitNum+1, k-lengNum, splitNum)
if splitNum == 0 {
for i := 0; i < k; i++ {
diff --git a/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts_test.go b/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts_test.go
index 233e0978..45642316 100644
--- a/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts_test.go
+++ b/leetcode/0725.Split-Linked-List-in-Parts/725. Split Linked List in Parts_test.go
@@ -29,42 +29,42 @@ func Test_Problem725(t *testing.T) {
qs := []question725{
- question725{
+ {
para725{[]int{1, 2, 3, 4, 5}, 7},
ans725{[]int{1, 2, 3, 4, 5, 0, 0}},
},
- question725{
+ {
para725{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 3},
ans725{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}},
},
- question725{
+ {
para725{[]int{1, 1, 1, 1, 1}, 1},
ans725{[]int{1, 1, 1, 1, 1}},
},
- question725{
+ {
para725{[]int{}, 3},
ans725{[]int{}},
},
- question725{
+ {
para725{[]int{1, 2, 3, 4, 5}, 5},
ans725{[]int{1, 2, 3, 4}},
},
- question725{
+ {
para725{[]int{}, 5},
ans725{[]int{}},
},
- question725{
+ {
para725{[]int{1, 2, 3, 4, 5}, 10},
ans725{[]int{1, 2, 3, 4, 5}},
},
- question725{
+ {
para725{[]int{1}, 1},
ans725{[]int{}},
},
diff --git a/leetcode/0726.Number-of-Atoms/726. Number of Atoms_test.go b/leetcode/0726.Number-of-Atoms/726. Number of Atoms_test.go
index d65bac31..a0ca4e59 100644
--- a/leetcode/0726.Number-of-Atoms/726. Number of Atoms_test.go
+++ b/leetcode/0726.Number-of-Atoms/726. Number of Atoms_test.go
@@ -26,22 +26,22 @@ func Test_Problem726(t *testing.T) {
qs := []question726{
- question726{
+ {
para726{"H200P"},
ans726{"H200P"},
},
- question726{
+ {
para726{"H2O"},
ans726{"H2O"},
},
- question726{
+ {
para726{"Mg(OH)2"},
ans726{"H2MgO2"},
},
- question726{
+ {
para726{"K4(ON(SO3)2)2"},
ans726{"K4N2O14S4"},
},
diff --git a/leetcode/0733.Flood-Fill/733. Flood Fill.go b/leetcode/0733.Flood-Fill/733. Flood Fill.go
index 38bd3bef..9cc8fe63 100644
--- a/leetcode/0733.Flood-Fill/733. Flood Fill.go
+++ b/leetcode/0733.Flood-Fill/733. Flood Fill.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func floodFill(image [][]int, sr int, sc int, newColor int) [][]int {
diff --git a/leetcode/0733.Flood-Fill/733. Flood Fill_test.go b/leetcode/0733.Flood-Fill/733. Flood Fill_test.go
index 3f1c706c..13d0e05c 100644
--- a/leetcode/0733.Flood-Fill/733. Flood Fill_test.go
+++ b/leetcode/0733.Flood-Fill/733. Flood Fill_test.go
@@ -29,16 +29,16 @@ func Test_Problem733(t *testing.T) {
qs := []question733{
- question733{
+ {
para733{[][]int{
- []int{1, 1, 1},
- []int{1, 1, 0},
- []int{1, 0, 1},
+ {1, 1, 1},
+ {1, 1, 0},
+ {1, 0, 1},
}, 1, 1, 2},
ans733{[][]int{
- []int{2, 2, 2},
- []int{2, 2, 0},
- []int{2, 0, 1},
+ {2, 2, 2},
+ {2, 2, 0},
+ {2, 0, 1},
}},
},
}
diff --git a/leetcode/0735.Asteroid-Collision/735. Asteroid Collision_test.go b/leetcode/0735.Asteroid-Collision/735. Asteroid Collision_test.go
index 322e5240..e37bbb91 100644
--- a/leetcode/0735.Asteroid-Collision/735. Asteroid Collision_test.go
+++ b/leetcode/0735.Asteroid-Collision/735. Asteroid Collision_test.go
@@ -26,32 +26,32 @@ func Test_Problem735(t *testing.T) {
qs := []question735{
- question735{
+ {
para735{[]int{-1, -1, 1, -2}},
ans735{[]int{-1, -1, -2}},
},
- question735{
+ {
para735{[]int{5, 10, -5}},
ans735{[]int{5, 10}},
},
- question735{
+ {
para735{[]int{5, 8, -8}},
ans735{[]int{5}},
},
- question735{
+ {
para735{[]int{8, -8}},
ans735{[]int{}},
},
- question735{
+ {
para735{[]int{10, 2, -5}},
ans735{[]int{10}},
},
- question735{
+ {
para735{[]int{-2, -1, 1, 2}},
ans735{[]int{-2, -1, 1, 2}},
},
diff --git a/leetcode/0739.Daily-Temperatures/739. Daily Temperatures_test.go b/leetcode/0739.Daily-Temperatures/739. Daily Temperatures_test.go
index 2171bca3..5266d620 100644
--- a/leetcode/0739.Daily-Temperatures/739. Daily Temperatures_test.go
+++ b/leetcode/0739.Daily-Temperatures/739. Daily Temperatures_test.go
@@ -26,7 +26,7 @@ func Test_Problem739(t *testing.T) {
qs := []question739{
- question739{
+ {
para739{[]int{73, 74, 75, 71, 69, 72, 76, 73}},
ans739{[]int{1, 1, 4, 2, 1, 1, 0, 0}},
},
diff --git a/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target/744. Find Smallest Letter Greater Than Target_test.go b/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target/744. Find Smallest Letter Greater Than Target_test.go
index 87060307..6592bad0 100644
--- a/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target/744. Find Smallest Letter Greater Than Target_test.go
+++ b/leetcode/0744.Find-Smallest-Letter-Greater-Than-Target/744. Find Smallest Letter Greater Than Target_test.go
@@ -27,32 +27,32 @@ func Test_Problem744(t *testing.T) {
qs := []question744{
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'a'},
ans744{'c'},
},
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'c'},
ans744{'f'},
},
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'd'},
ans744{'f'},
},
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'g'},
ans744{'j'},
},
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'j'},
ans744{'c'},
},
- question744{
+ {
para744{[]byte{'c', 'f', 'j'}, 'k'},
ans744{'c'},
},
diff --git a/leetcode/0746.Min-Cost-Climbing-Stairs/746. Min Cost Climbing Stairs_test.go b/leetcode/0746.Min-Cost-Climbing-Stairs/746. Min Cost Climbing Stairs_test.go
index 59a0bd98..e09c5efe 100644
--- a/leetcode/0746.Min-Cost-Climbing-Stairs/746. Min Cost Climbing Stairs_test.go
+++ b/leetcode/0746.Min-Cost-Climbing-Stairs/746. Min Cost Climbing Stairs_test.go
@@ -26,12 +26,12 @@ func Test_Problem746(t *testing.T) {
qs := []question746{
- question746{
+ {
para746{[]int{10, 15, 20}},
ans746{15},
},
- question746{
+ {
para746{[]int{1, 100, 1, 1, 1, 100, 1, 1, 100, 1}},
ans746{6},
},
diff --git a/leetcode/0748.Shortest-Completing-Word/748. Shortest Completing Word_test.go b/leetcode/0748.Shortest-Completing-Word/748. Shortest Completing Word_test.go
index 78292b82..32be3fa1 100644
--- a/leetcode/0748.Shortest-Completing-Word/748. Shortest Completing Word_test.go
+++ b/leetcode/0748.Shortest-Completing-Word/748. Shortest Completing Word_test.go
@@ -27,12 +27,12 @@ func Test_Problem748(t *testing.T) {
qs := []question748{
- question748{
+ {
para748{"1s3 PSt", []string{"step", "steps", "stripe", "stepple"}},
ans748{"steps"},
},
- question748{
+ {
para748{"1s3 456", []string{"looks", "pest", "stew", "show"}},
ans748{"pest"},
},
diff --git a/leetcode/0753.Cracking-the-Safe/753. Cracking the Safe_test.go b/leetcode/0753.Cracking-the-Safe/753. Cracking the Safe_test.go
index fb9fda24..169a8549 100644
--- a/leetcode/0753.Cracking-the-Safe/753. Cracking the Safe_test.go
+++ b/leetcode/0753.Cracking-the-Safe/753. Cracking the Safe_test.go
@@ -27,12 +27,12 @@ func Test_Problem753(t *testing.T) {
qs := []question753{
- question753{
+ {
para753{1, 2},
ans753{"01"},
},
- question753{
+ {
para753{2, 2},
ans753{"00110"},
},
diff --git a/leetcode/0756.Pyramid-Transition-Matrix/756. Pyramid Transition Matrix_test.go b/leetcode/0756.Pyramid-Transition-Matrix/756. Pyramid Transition Matrix_test.go
index 986885cf..a6684038 100644
--- a/leetcode/0756.Pyramid-Transition-Matrix/756. Pyramid Transition Matrix_test.go
+++ b/leetcode/0756.Pyramid-Transition-Matrix/756. Pyramid Transition Matrix_test.go
@@ -27,12 +27,12 @@ func Test_Problem756(t *testing.T) {
qs := []question756{
- question756{
+ {
para756{"BCD", []string{"BCG", "CDE", "GEA", "FFF"}},
ans756{true},
},
- question756{
+ {
para756{"AABA", []string{"AAA", "AAB", "ABA", "ABB", "BAC"}},
ans756{false},
},
diff --git a/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation/762. Prime Number of Set Bits in Binary Representation_test.go b/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation/762. Prime Number of Set Bits in Binary Representation_test.go
index a57f0c44..1c3c0de2 100644
--- a/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation/762. Prime Number of Set Bits in Binary Representation_test.go
+++ b/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation/762. Prime Number of Set Bits in Binary Representation_test.go
@@ -27,12 +27,12 @@ func Test_Problem762(t *testing.T) {
qs := []question762{
- question762{
+ {
para762{6, 10},
ans762{4},
},
- question762{
+ {
para762{10, 15},
ans762{5},
},
diff --git a/leetcode/0763.Partition-Labels/763. Partition Labels_test.go b/leetcode/0763.Partition-Labels/763. Partition Labels_test.go
index 3e258b90..8ac0c07e 100644
--- a/leetcode/0763.Partition-Labels/763. Partition Labels_test.go
+++ b/leetcode/0763.Partition-Labels/763. Partition Labels_test.go
@@ -26,7 +26,7 @@ func Test_Problem763(t *testing.T) {
qs := []question763{
- question763{
+ {
para763{"ababcbacadefegdehijhklij"},
ans763{[]int{9, 7, 8}},
},
diff --git a/leetcode/0765.Couples-Holding-Hands/765. Couples Holding Hands_test.go b/leetcode/0765.Couples-Holding-Hands/765. Couples Holding Hands_test.go
index 46cd1bef..fb0c7018 100644
--- a/leetcode/0765.Couples-Holding-Hands/765. Couples Holding Hands_test.go
+++ b/leetcode/0765.Couples-Holding-Hands/765. Couples Holding Hands_test.go
@@ -26,22 +26,22 @@ func Test_Problem765(t *testing.T) {
qs := []question765{
- question765{
+ {
para765{[]int{0, 2, 1, 3}},
ans765{1},
},
- question765{
+ {
para765{[]int{3, 2, 0, 1}},
ans765{0},
},
- question765{
+ {
para765{[]int{3, 1, 4, 0, 2, 5}},
ans765{2},
},
- question765{
+ {
para765{[]int{10, 7, 4, 2, 3, 0, 9, 11, 1, 5, 6, 8}},
ans765{4},
},
diff --git a/leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix_test.go b/leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix_test.go
index f32a915f..fa18cb75 100644
--- a/leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix_test.go
+++ b/leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix_test.go
@@ -26,13 +26,13 @@ func Test_Problem766(t *testing.T) {
qs := []question766{
- question766{
- para766{[][]int{[]int{1, 2, 3, 4}, []int{5, 1, 2, 3}, []int{9, 5, 1, 2}}},
+ {
+ para766{[][]int{{1, 2, 3, 4}, {5, 1, 2, 3}, {9, 5, 1, 2}}},
ans766{true},
},
- question766{
- para766{[][]int{[]int{1, 2}, []int{2, 2}}},
+ {
+ para766{[][]int{{1, 2}, {2, 2}}},
ans766{false},
},
}
diff --git a/leetcode/0767.Reorganize-String/767. Reorganize String_test.go b/leetcode/0767.Reorganize-String/767. Reorganize String_test.go
index 7c67ee5f..ab8f52ec 100644
--- a/leetcode/0767.Reorganize-String/767. Reorganize String_test.go
+++ b/leetcode/0767.Reorganize-String/767. Reorganize String_test.go
@@ -25,12 +25,12 @@ type ans767 struct {
func Test_Problem767(t *testing.T) {
qs := []question767{
- question767{
+ {
para767{"aab"},
ans767{"aba"},
},
- question767{
+ {
para767{"aaab"},
ans767{""},
},
diff --git a/leetcode/0771.Jewels-and-Stones/771. Jewels and Stones_test.go b/leetcode/0771.Jewels-and-Stones/771. Jewels and Stones_test.go
index b9dae4cb..8cdc308e 100644
--- a/leetcode/0771.Jewels-and-Stones/771. Jewels and Stones_test.go
+++ b/leetcode/0771.Jewels-and-Stones/771. Jewels and Stones_test.go
@@ -26,12 +26,12 @@ type ans771 struct {
func Test_Problem771(t *testing.T) {
qs := []question771{
- question771{
+ {
para771{"aA", "aAAbbbb"},
ans771{3},
},
- question771{
+ {
para771{"z", "ZZ"},
ans771{0},
},
diff --git a/leetcode/0778.Swim-in-Rising-Water/778. Swim in Rising Water_test.go b/leetcode/0778.Swim-in-Rising-Water/778. Swim in Rising Water_test.go
index d78aeff2..6523d003 100644
--- a/leetcode/0778.Swim-in-Rising-Water/778. Swim in Rising Water_test.go
+++ b/leetcode/0778.Swim-in-Rising-Water/778. Swim in Rising Water_test.go
@@ -25,13 +25,13 @@ type ans778 struct {
func Test_Problem778(t *testing.T) {
qs := []question778{
- question778{
- para778{[][]int{[]int{0, 2}, []int{1, 3}}},
+ {
+ para778{[][]int{{0, 2}, {1, 3}}},
ans778{3},
},
- question778{
- para778{[][]int{[]int{0, 1, 2, 3, 4}, []int{24, 23, 22, 21, 5}, []int{12, 13, 14, 15, 16}, []int{11, 17, 18, 19, 20}, []int{10, 9, 8, 7, 6}}},
+ {
+ para778{[][]int{{0, 1, 2, 3, 4}, {24, 23, 22, 21, 5}, {12, 13, 14, 15, 16}, {11, 17, 18, 19, 20}, {10, 9, 8, 7, 6}}},
ans778{16},
},
}
diff --git a/leetcode/0781.Rabbits-in-Forest/781. Rabbits in Forest_test.go b/leetcode/0781.Rabbits-in-Forest/781. Rabbits in Forest_test.go
index f8c8bed1..093dd287 100644
--- a/leetcode/0781.Rabbits-in-Forest/781. Rabbits in Forest_test.go
+++ b/leetcode/0781.Rabbits-in-Forest/781. Rabbits in Forest_test.go
@@ -25,17 +25,17 @@ type ans781 struct {
func Test_Problem781(t *testing.T) {
qs := []question781{
- question781{
+ {
para781{[]int{1, 1, 2}},
ans781{5},
},
- question781{
+ {
para781{[]int{10, 10, 10}},
ans781{11},
},
- question781{
+ {
para781{[]int{}},
ans781{0},
},
diff --git a/leetcode/0784.Letter-Case-Permutation/784. Letter Case Permutation_test.go b/leetcode/0784.Letter-Case-Permutation/784. Letter Case Permutation_test.go
index 5eb38516..9891c4e6 100644
--- a/leetcode/0784.Letter-Case-Permutation/784. Letter Case Permutation_test.go
+++ b/leetcode/0784.Letter-Case-Permutation/784. Letter Case Permutation_test.go
@@ -26,27 +26,27 @@ func Test_Problem784(t *testing.T) {
qs := []question784{
- question784{
+ {
para784{"mQe"},
ans784{[]string{"mqe", "mqE", "mQe", "mQE", "Mqe", "MqE", "MQe", "MQE"}},
},
- question784{
+ {
para784{"C"},
ans784{[]string{"c", "C"}},
},
- question784{
+ {
para784{"a1b2"},
ans784{[]string{"a1b2", "a1B2", "A1b2", "A1B2"}},
},
- question784{
+ {
para784{"3z4"},
ans784{[]string{"3z4", "3Z4"}},
},
- question784{
+ {
para784{"12345"},
ans784{[]string{"12345"}},
},
diff --git a/leetcode/0786.K-th-Smallest-Prime-Fraction/786. K-th Smallest Prime Fraction_test.go b/leetcode/0786.K-th-Smallest-Prime-Fraction/786. K-th Smallest Prime Fraction_test.go
index dbb27301..4fde3438 100644
--- a/leetcode/0786.K-th-Smallest-Prime-Fraction/786. K-th Smallest Prime Fraction_test.go
+++ b/leetcode/0786.K-th-Smallest-Prime-Fraction/786. K-th Smallest Prime Fraction_test.go
@@ -27,22 +27,22 @@ func Test_Problem786(t *testing.T) {
qs := []question786{
- question786{
+ {
para786{[]int{1, 2, 3, 5}, 3},
ans786{[]int{2, 5}},
},
- question786{
+ {
para786{[]int{1, 7}, 1},
ans786{[]int{1, 7}},
},
- question786{
+ {
para786{[]int{1, 2}, 1},
ans786{[]int{1, 2}},
},
- question786{
+ {
para786{[]int{1, 2, 3, 5, 7}, 6},
ans786{[]int{3, 7}},
},
diff --git a/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function/793. Preimage Size of Factorial Zeroes Function_test.go b/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function/793. Preimage Size of Factorial Zeroes Function_test.go
index ce55d208..de6ab01e 100644
--- a/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function/793. Preimage Size of Factorial Zeroes Function_test.go
+++ b/leetcode/0793.Preimage-Size-of-Factorial-Zeroes-Function/793. Preimage Size of Factorial Zeroes Function_test.go
@@ -26,12 +26,12 @@ func Test_Problem793(t *testing.T) {
qs := []question793{
- question793{
+ {
para793{0},
ans793{5},
},
- question793{
+ {
para793{5},
ans793{0},
},
diff --git a/leetcode/0802.Find-Eventual-Safe-States/802. Find Eventual Safe States_test.go b/leetcode/0802.Find-Eventual-Safe-States/802. Find Eventual Safe States_test.go
index 230d2c4c..631e49d7 100644
--- a/leetcode/0802.Find-Eventual-Safe-States/802. Find Eventual Safe States_test.go
+++ b/leetcode/0802.Find-Eventual-Safe-States/802. Find Eventual Safe States_test.go
@@ -26,8 +26,8 @@ func Test_Problem802(t *testing.T) {
qs := []question802{
- question802{
- para802{[][]int{[]int{1, 2}, []int{2, 3}, []int{5}, []int{0}, []int{5}, []int{}, []int{}}},
+ {
+ para802{[][]int{{1, 2}, {2, 3}, {5}, {0}, {5}, {}, {}}},
ans802{[]int{2, 4, 5, 6}},
},
}
diff --git a/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit.go b/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit.go
index 6ec4f44f..879835c1 100644
--- a/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit.go
+++ b/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit.go
@@ -5,10 +5,10 @@ import (
)
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func hitBricks(grid [][]int, hits [][]int) []int {
diff --git a/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit_test.go b/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit_test.go
index 35bfa3de..558e7c50 100644
--- a/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit_test.go
+++ b/leetcode/0803.Bricks-Falling-When-Hit/803. Bricks Falling When Hit_test.go
@@ -27,23 +27,23 @@ func Test_Problem803(t *testing.T) {
qs := []question803{
- question803{
- para803{[][]int{[]int{1, 1, 1, 0, 1, 1, 1, 1}, []int{1, 0, 0, 0, 0, 1, 1, 1}, []int{1, 1, 1, 0, 0, 0, 1, 1}, []int{1, 1, 0, 0, 0, 0, 0, 0}, []int{1, 0, 0, 0, 0, 0, 0, 0}, []int{1, 0, 0, 0, 0, 0, 0, 0}},
- [][]int{[]int{4, 6}, []int{3, 0}, []int{2, 3}, []int{2, 6}, []int{4, 1}, []int{5, 2}, []int{2, 1}}},
+ {
+ para803{[][]int{{1, 1, 1, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 1, 1, 1}, {1, 1, 1, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}},
+ [][]int{{4, 6}, {3, 0}, {2, 3}, {2, 6}, {4, 1}, {5, 2}, {2, 1}}},
ans803{[]int{0, 2, 0, 0, 0, 0, 2}},
},
- question803{
- para803{[][]int{[]int{1, 0, 1}, []int{1, 1, 1}}, [][]int{[]int{0, 0}, []int{0, 2}, []int{1, 1}}},
+ {
+ para803{[][]int{{1, 0, 1}, {1, 1, 1}}, [][]int{{0, 0}, {0, 2}, {1, 1}}},
ans803{[]int{0, 3, 0}},
},
- question803{
- para803{[][]int{[]int{1, 0, 0, 0}, []int{1, 1, 1, 0}}, [][]int{[]int{1, 0}}},
+ {
+ para803{[][]int{{1, 0, 0, 0}, {1, 1, 1, 0}}, [][]int{{1, 0}}},
ans803{[]int{2}},
},
- question803{
- para803{[][]int{[]int{1, 0, 0, 0}, []int{1, 1, 0, 0}}, [][]int{[]int{1, 1}, []int{1, 0}}},
+ {
+ para803{[][]int{{1, 0, 0, 0}, {1, 1, 0, 0}}, [][]int{{1, 1}, {1, 0}}},
ans803{[]int{0, 0}},
},
}
diff --git a/leetcode/0811.Subdomain-Visit-Count/811. Subdomain Visit Count_test.go b/leetcode/0811.Subdomain-Visit-Count/811. Subdomain Visit Count_test.go
index 5176905a..700e7d97 100644
--- a/leetcode/0811.Subdomain-Visit-Count/811. Subdomain Visit Count_test.go
+++ b/leetcode/0811.Subdomain-Visit-Count/811. Subdomain Visit Count_test.go
@@ -26,12 +26,12 @@ func Test_Problem811(t *testing.T) {
qs := []question811{
- question811{
+ {
para811{[]string{"9001 discuss.leetcode.com"}},
ans811{[]string{"mqe", "mqE", "mQe", "mQE", "Mqe", "MqE", "MQe", "MQE"}},
},
- question811{
+ {
para811{[]string{"900 google.mail.com", "50 yahoo.com", "1 intel.mail.com", "5 wiki.org"}},
ans811{[]string{"901 mail.com", "50 yahoo.com", "900 google.mail.com", "5 wiki.org", "5 org", "1 intel.mail.com", "951 com"}},
},
diff --git a/leetcode/0812.Largest-Triangle-Area/812. Largest Triangle Area_test.go b/leetcode/0812.Largest-Triangle-Area/812. Largest Triangle Area_test.go
index 8e461ca2..140980b0 100644
--- a/leetcode/0812.Largest-Triangle-Area/812. Largest Triangle Area_test.go
+++ b/leetcode/0812.Largest-Triangle-Area/812. Largest Triangle Area_test.go
@@ -26,8 +26,8 @@ func Test_Problem812(t *testing.T) {
qs := []question812{
- question812{
- para812{[][]int{[]int{0, 0}, []int{0, 1}, []int{1, 0}, []int{0, 2}, []int{2, 0}}},
+ {
+ para812{[][]int{{0, 0}, {0, 1}, {1, 0}, {0, 2}, {2, 0}}},
ans812{2.0},
},
}
diff --git a/leetcode/0815.Bus-Routes/815. Bus Routes_test.go b/leetcode/0815.Bus-Routes/815. Bus Routes_test.go
index 271d1370..5581144e 100644
--- a/leetcode/0815.Bus-Routes/815. Bus Routes_test.go
+++ b/leetcode/0815.Bus-Routes/815. Bus Routes_test.go
@@ -28,8 +28,8 @@ func Test_Problem815(t *testing.T) {
qs := []question815{
- question815{
- para815{[][]int{[]int{1, 2, 7}, []int{3, 6, 7}}, 1, 6},
+ {
+ para815{[][]int{{1, 2, 7}, {3, 6, 7}}, 1, 6},
ans815{2},
},
}
diff --git a/leetcode/0817.Linked-List-Components/817. Linked List Components_test.go b/leetcode/0817.Linked-List-Components/817. Linked List Components_test.go
index d33235bf..e1d35158 100644
--- a/leetcode/0817.Linked-List-Components/817. Linked List Components_test.go
+++ b/leetcode/0817.Linked-List-Components/817. Linked List Components_test.go
@@ -29,37 +29,37 @@ func Test_Problem817(t *testing.T) {
qs := []question817{
- question817{
+ {
para817{[]int{0, 1, 2, 3}, []int{0, 1, 3}},
ans817{2},
},
- question817{
+ {
para817{[]int{1, 2, 3, 4}, []int{1, 2, 3, 4}},
ans817{1},
},
- question817{
+ {
para817{[]int{0, 1, 2, 3, 4}, []int{0, 3, 1, 4}},
ans817{2},
},
- question817{
+ {
para817{[]int{0, 1, 2}, []int{0, 2}},
ans817{2},
},
- question817{
+ {
para817{[]int{1, 2, 0, 4, 3}, []int{3, 4, 0, 2, 1}},
ans817{1},
},
- question817{
+ {
para817{[]int{0, 2, 4, 3, 1}, []int{3, 2, 4}},
ans817{1},
},
- question817{
+ {
para817{[]int{7, 5, 13, 3, 16, 11, 12, 0, 17, 1, 4, 15, 6, 14, 2, 19, 9, 10, 8, 18}, []int{8, 10, 3, 11, 17, 16, 7, 9, 5, 15, 13, 6}},
ans817{4},
},
diff --git a/leetcode/0819.Most-Common-Word/819. Most Common Word_test.go b/leetcode/0819.Most-Common-Word/819. Most Common Word_test.go
index b9478810..c0e8265a 100644
--- a/leetcode/0819.Most-Common-Word/819. Most Common Word_test.go
+++ b/leetcode/0819.Most-Common-Word/819. Most Common Word_test.go
@@ -27,7 +27,7 @@ func Test_Problem819(t *testing.T) {
qs := []question819{
- question819{
+ {
para819{"Bob hit a ball, the hit BALL flew far after it was hit.", []string{"hit"}},
ans819{"ball"},
},
diff --git a/leetcode/0826.Most-Profit-Assigning-Work/826. Most Profit Assigning Work_test.go b/leetcode/0826.Most-Profit-Assigning-Work/826. Most Profit Assigning Work_test.go
index a7ab61d0..a89eb586 100644
--- a/leetcode/0826.Most-Profit-Assigning-Work/826. Most Profit Assigning Work_test.go
+++ b/leetcode/0826.Most-Profit-Assigning-Work/826. Most Profit Assigning Work_test.go
@@ -28,12 +28,12 @@ func Test_Problem826(t *testing.T) {
qs := []question826{
- question826{
+ {
para826{[]int{2, 4, 6, 8, 10}, []int{10, 20, 30, 40, 50}, []int{4, 5, 6, 7}},
ans826{100},
},
- question826{
+ {
para826{[]int{85, 47, 57}, []int{24, 66, 99}, []int{40, 25, 25}},
ans826{0},
},
diff --git a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go b/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go
index 92dd5f76..9129b8b4 100644
--- a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go
+++ b/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String.go
@@ -21,10 +21,9 @@ func uniqueLetterString1(S string) int {
if len(S) == 0 {
return 0
}
- letterMap := map[byte]int{}
res, mod := 0, 1000000007
for i := 0; i < len(S); i++ {
- letterMap = map[byte]int{}
+ letterMap := map[byte]int{}
for j := i; j < len(S); j++ {
letterMap[S[j]]++
tmp := 0
diff --git a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go b/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go
index 15a21e40..620c32ba 100644
--- a/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go
+++ b/leetcode/0828.COPYRIGHT-PROBLEM-XXX/828. Unique Letter String_test.go
@@ -26,22 +26,22 @@ func Test_Problem828(t *testing.T) {
qs := []question828{
- question828{
+ {
para828{"BABABBABAA"},
ans828{35},
},
- question828{
+ {
para828{"ABC"},
ans828{10},
},
- question828{
+ {
para828{"ABA"},
ans828{8},
},
- question828{
+ {
para828{"ABAB"},
ans828{12},
},
diff --git a/leetcode/0832.Flipping-an-Image/832. Flipping an Image_test.go b/leetcode/0832.Flipping-an-Image/832. Flipping an Image_test.go
index de639ef7..9705a0bb 100644
--- a/leetcode/0832.Flipping-an-Image/832. Flipping an Image_test.go
+++ b/leetcode/0832.Flipping-an-Image/832. Flipping an Image_test.go
@@ -26,19 +26,19 @@ func Test_Problem832(t *testing.T) {
qs := []question832{
- question832{
- para832{[][]int{[]int{1, 1, 0}, []int{1, 0, 1}, []int{0, 0, 0}}},
- ans832{[][]int{[]int{1, 0, 0}, []int{0, 1, 0}, []int{1, 1, 1}}},
+ {
+ para832{[][]int{{1, 1, 0}, {1, 0, 1}, {0, 0, 0}}},
+ ans832{[][]int{{1, 0, 0}, {0, 1, 0}, {1, 1, 1}}},
},
- question832{
- para832{[][]int{[]int{1, 1, 0, 0}, []int{1, 0, 0, 1}, []int{0, 1, 1, 1}, []int{1, 0, 1, 0}}},
- ans832{[][]int{[]int{1, 1, 0, 0}, []int{0, 1, 1, 0}, []int{0, 0, 0, 1}, []int{1, 0, 1, 0}}},
+ {
+ para832{[][]int{{1, 1, 0, 0}, {1, 0, 0, 1}, {0, 1, 1, 1}, {1, 0, 1, 0}}},
+ ans832{[][]int{{1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 1}, {1, 0, 1, 0}}},
},
- question832{
- para832{[][]int{[]int{1, 1, 1}, []int{1, 1, 1}, []int{0, 0, 0}}},
- ans832{[][]int{[]int{0, 0, 0}, []int{0, 0, 0}, []int{1, 1, 1}}},
+ {
+ para832{[][]int{{1, 1, 1}, {1, 1, 1}, {0, 0, 0}}},
+ ans832{[][]int{{0, 0, 0}, {0, 0, 0}, {1, 1, 1}}},
},
}
diff --git a/leetcode/0834.Sum-of-Distances-in-Tree/834. Sum of Distances in Tree_test.go b/leetcode/0834.Sum-of-Distances-in-Tree/834. Sum of Distances in Tree_test.go
index 6e6f0961..7df04f42 100644
--- a/leetcode/0834.Sum-of-Distances-in-Tree/834. Sum of Distances in Tree_test.go
+++ b/leetcode/0834.Sum-of-Distances-in-Tree/834. Sum of Distances in Tree_test.go
@@ -27,13 +27,13 @@ func Test_Problem834(t *testing.T) {
qs := []question834{
- question834{
- para834{4, [][]int{[]int{1, 2}, []int{3, 2}, []int{3, 0}}},
+ {
+ para834{4, [][]int{{1, 2}, {3, 2}, {3, 0}}},
ans834{[]int{6, 6, 4, 4}},
},
- question834{
- para834{6, [][]int{[]int{0, 1}, []int{0, 2}, []int{2, 3}, []int{2, 4}, []int{2, 5}}},
+ {
+ para834{6, [][]int{{0, 1}, {0, 2}, {2, 3}, {2, 4}, {2, 5}}},
ans834{[]int{8, 12, 6, 10, 10, 10}},
},
}
diff --git a/leetcode/0836.Rectangle-Overlap/836. Rectangle Overlap_test.go b/leetcode/0836.Rectangle-Overlap/836. Rectangle Overlap_test.go
index 82bd577b..2acbcb4d 100644
--- a/leetcode/0836.Rectangle-Overlap/836. Rectangle Overlap_test.go
+++ b/leetcode/0836.Rectangle-Overlap/836. Rectangle Overlap_test.go
@@ -27,12 +27,12 @@ func Test_Problem836(t *testing.T) {
qs := []question836{
- question836{
+ {
para836{[]int{0, 0, 2, 2}, []int{1, 1, 3, 3}},
ans836{true},
},
- question836{
+ {
para836{[]int{0, 0, 1, 1}, []int{1, 0, 2, 1}},
ans836{false},
},
diff --git a/leetcode/0838.Push-Dominoes/838. Push Dominoes_test.go b/leetcode/0838.Push-Dominoes/838. Push Dominoes_test.go
index 26b4ebd4..83aa148b 100644
--- a/leetcode/0838.Push-Dominoes/838. Push Dominoes_test.go
+++ b/leetcode/0838.Push-Dominoes/838. Push Dominoes_test.go
@@ -26,17 +26,17 @@ func Test_Problem838(t *testing.T) {
qs := []question838{
- question838{
+ {
para838{".L.R...LR..L.."},
ans838{"LL.RR.LLRRLL.."},
},
- question838{
+ {
para838{"RR.L"},
ans838{"RR.L"},
},
- question838{
+ {
para838{".L.R."},
ans838{"LL.RR"},
},
diff --git a/leetcode/0839.Similar-String-Groups/839. Similar String Groups_test.go b/leetcode/0839.Similar-String-Groups/839. Similar String Groups_test.go
index d469edc1..1482cc50 100644
--- a/leetcode/0839.Similar-String-Groups/839. Similar String Groups_test.go
+++ b/leetcode/0839.Similar-String-Groups/839. Similar String Groups_test.go
@@ -26,7 +26,7 @@ func Test_Problem839(t *testing.T) {
qs := []question839{
- question839{
+ {
para839{[]string{"tars", "rats", "arts", "star"}},
ans839{2},
},
diff --git a/leetcode/0841.Keys-and-Rooms/841. Keys and Rooms_test.go b/leetcode/0841.Keys-and-Rooms/841. Keys and Rooms_test.go
index ae64e7b3..8d3dfed9 100644
--- a/leetcode/0841.Keys-and-Rooms/841. Keys and Rooms_test.go
+++ b/leetcode/0841.Keys-and-Rooms/841. Keys and Rooms_test.go
@@ -26,13 +26,13 @@ func Test_Problem841(t *testing.T) {
qs := []question841{
- question841{
- para841{[][]int{[]int{1}, []int{2}, []int{3}, []int{}}},
+ {
+ para841{[][]int{{1}, {2}, {3}, {}}},
ans841{true},
},
- question841{
- para841{[][]int{[]int{1, 3}, []int{3, 0, 1}, []int{2}, []int{0}}},
+ {
+ para841{[][]int{{1, 3}, {3, 0, 1}, {2}, {0}}},
ans841{false},
},
}
diff --git a/leetcode/0842.Split-Array-into-Fibonacci-Sequence/842. Split Array into Fibonacci Sequence_test.go b/leetcode/0842.Split-Array-into-Fibonacci-Sequence/842. Split Array into Fibonacci Sequence_test.go
index 88d21ed2..b6e20c4c 100644
--- a/leetcode/0842.Split-Array-into-Fibonacci-Sequence/842. Split Array into Fibonacci Sequence_test.go
+++ b/leetcode/0842.Split-Array-into-Fibonacci-Sequence/842. Split Array into Fibonacci Sequence_test.go
@@ -26,37 +26,37 @@ func Test_Problem842(t *testing.T) {
qs := []question842{
- question842{
+ {
para842{"11235813"},
ans842{[]int{1, 1, 2, 3, 5, 8, 13}},
},
- question842{
+ {
para842{"123456579"},
ans842{[]int{123, 456, 579}},
},
- question842{
+ {
para842{"112358130"},
ans842{[]int{}},
},
- question842{
+ {
para842{"0123"},
ans842{[]int{}},
},
- question842{
+ {
para842{"1101111"},
ans842{[]int{110, 1, 111}},
},
- question842{
+ {
para842{"539834657215398346785398346991079669377161950407626991734534318677529701785098211336528511"},
ans842{[]int{}},
},
- question842{
+ {
para842{"3611537383985343591834441270352104793375145479938855071433500231900737525076071514982402115895535257195564161509167334647108949738176284385285234123461518508746752631120827113919550237703163294909"},
ans842{[]int{}},
},
diff --git a/leetcode/0844.Backspace-String-Compare/844. Backspace String Compare_test.go b/leetcode/0844.Backspace-String-Compare/844. Backspace String Compare_test.go
index 5d7542f8..7047964e 100644
--- a/leetcode/0844.Backspace-String-Compare/844. Backspace String Compare_test.go
+++ b/leetcode/0844.Backspace-String-Compare/844. Backspace String Compare_test.go
@@ -27,22 +27,22 @@ func Test_Problem844(t *testing.T) {
qs := []question844{
- question844{
+ {
para844{"ab#c", "ad#c"},
ans844{true},
},
- question844{
+ {
para844{"ab##", "c#d#"},
ans844{true},
},
- question844{
+ {
para844{"a##c", "#a#c"},
ans844{true},
},
- question844{
+ {
para844{"a#c", "b"},
ans844{false},
},
diff --git a/leetcode/0845.Longest-Mountain-in-Array/845. Longest Mountain in Array_test.go b/leetcode/0845.Longest-Mountain-in-Array/845. Longest Mountain in Array_test.go
index ab87a6d3..9edaaa4e 100644
--- a/leetcode/0845.Longest-Mountain-in-Array/845. Longest Mountain in Array_test.go
+++ b/leetcode/0845.Longest-Mountain-in-Array/845. Longest Mountain in Array_test.go
@@ -25,27 +25,27 @@ type ans845 struct {
func Test_Problem845(t *testing.T) {
qs := []question845{
- question845{
+ {
para845{[]int{875, 884, 239, 731, 723, 685}},
ans845{4},
},
- question845{
+ {
para845{[]int{0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0}},
ans845{11},
},
- question845{
+ {
para845{[]int{2, 3}},
ans845{0},
},
- question845{
+ {
para845{[]int{2, 1, 4, 7, 3, 2, 5}},
ans845{5},
},
- question845{
+ {
para845{[]int{2, 2, 2}},
ans845{0},
},
diff --git a/leetcode/0850.Rectangle-Area-II/850. Rectangle Area II_test.go b/leetcode/0850.Rectangle-Area-II/850. Rectangle Area II_test.go
index fa749815..69f9f940 100644
--- a/leetcode/0850.Rectangle-Area-II/850. Rectangle Area II_test.go
+++ b/leetcode/0850.Rectangle-Area-II/850. Rectangle Area II_test.go
@@ -26,23 +26,23 @@ func Test_Problem850(t *testing.T) {
qs := []question850{
- question850{
- para850{[][]int{[]int{0, 0, 3, 3}, []int{2, 0, 5, 3}, []int{1, 1, 4, 4}}},
+ {
+ para850{[][]int{{0, 0, 3, 3}, {2, 0, 5, 3}, {1, 1, 4, 4}}},
ans850{18},
},
- question850{
- para850{[][]int{[]int{0, 0, 1, 1}, []int{2, 2, 3, 3}}},
+ {
+ para850{[][]int{{0, 0, 1, 1}, {2, 2, 3, 3}}},
ans850{2},
},
- question850{
- para850{[][]int{[]int{0, 0, 2, 2}, []int{1, 0, 2, 3}, []int{1, 0, 3, 1}}},
+ {
+ para850{[][]int{{0, 0, 2, 2}, {1, 0, 2, 3}, {1, 0, 3, 1}}},
ans850{6},
},
- question850{
- para850{[][]int{[]int{0, 0, 1000000000, 1000000000}}},
+ {
+ para850{[][]int{{0, 0, 1000000000, 1000000000}}},
ans850{49},
},
}
diff --git a/leetcode/0851.Loud-and-Rich/851. Loud and Rich_test.go b/leetcode/0851.Loud-and-Rich/851. Loud and Rich_test.go
index bd06e31b..f3ebd587 100644
--- a/leetcode/0851.Loud-and-Rich/851. Loud and Rich_test.go
+++ b/leetcode/0851.Loud-and-Rich/851. Loud and Rich_test.go
@@ -27,8 +27,8 @@ func Test_Problem851(t *testing.T) {
qs := []question851{
- question851{
- para851{[][]int{[]int{1, 0}, []int{2, 1}, []int{3, 1}, []int{3, 7}, []int{4, 3}, []int{5, 3}}, []int{3, 2, 5, 4, 6, 1, 7, 0}},
+ {
+ para851{[][]int{{1, 0}, {2, 1}, {3, 1}, {3, 7}, {4, 3}, {5, 3}}, []int{3, 2, 5, 4, 6, 1, 7, 0}},
ans851{[]int{5, 5, 2, 5, 4, 5, 6, 7}},
},
}
diff --git a/leetcode/0852.Peak-Index-in-a-Mountain-Array/852. Peak Index in a Mountain Array_test.go b/leetcode/0852.Peak-Index-in-a-Mountain-Array/852. Peak Index in a Mountain Array_test.go
index 28427fbd..431cd572 100644
--- a/leetcode/0852.Peak-Index-in-a-Mountain-Array/852. Peak Index in a Mountain Array_test.go
+++ b/leetcode/0852.Peak-Index-in-a-Mountain-Array/852. Peak Index in a Mountain Array_test.go
@@ -26,12 +26,12 @@ func Test_Problem852(t *testing.T) {
qs := []question852{
- question852{
+ {
para852{[]int{0, 1, 0}},
ans852{1},
},
- question852{
+ {
para852{[]int{0, 2, 1, 0}},
ans852{1},
},
diff --git a/leetcode/0853.Car-Fleet/853. Car Fleet_test.go b/leetcode/0853.Car-Fleet/853. Car Fleet_test.go
index bfeac040..03fc2d39 100644
--- a/leetcode/0853.Car-Fleet/853. Car Fleet_test.go
+++ b/leetcode/0853.Car-Fleet/853. Car Fleet_test.go
@@ -28,7 +28,7 @@ func Test_Problem853(t *testing.T) {
qs := []question853{
- question853{
+ {
para853{12, []int{10, 8, 0, 5, 3}, []int{2, 4, 1, 1, 3}},
ans853{3},
},
diff --git a/leetcode/0856.Score-of-Parentheses/856. Score of Parentheses_test.go b/leetcode/0856.Score-of-Parentheses/856. Score of Parentheses_test.go
index 634f6c7d..d26fddfe 100644
--- a/leetcode/0856.Score-of-Parentheses/856. Score of Parentheses_test.go
+++ b/leetcode/0856.Score-of-Parentheses/856. Score of Parentheses_test.go
@@ -25,32 +25,32 @@ type ans856 struct {
func Test_Problem856(t *testing.T) {
qs := []question856{
- question856{
+ {
para856{"()"},
ans856{1},
},
- question856{
+ {
para856{"(())"},
ans856{2},
},
- question856{
+ {
para856{"()()"},
ans856{2},
},
- question856{
+ {
para856{"(()(()))"},
ans856{6},
},
- question856{
+ {
para856{"()(())"},
ans856{3},
},
- question856{
+ {
para856{"((()()))"},
ans856{8},
},
diff --git a/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K/862. Shortest Subarray with Sum at Least K_test.go b/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K/862. Shortest Subarray with Sum at Least K_test.go
index 1bb266ca..8f585559 100644
--- a/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K/862. Shortest Subarray with Sum at Least K_test.go
+++ b/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K/862. Shortest Subarray with Sum at Least K_test.go
@@ -26,17 +26,17 @@ type ans862 struct {
func Test_Problem862(t *testing.T) {
qs := []question862{
- question862{
+ {
para862{[]int{1}, 1},
ans862{1},
},
- question862{
+ {
para862{[]int{1, 2}, 4},
ans862{-1},
},
- question862{
+ {
para862{[]int{2, -1, 2}, 3},
ans862{3},
},
diff --git a/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree/863. All Nodes Distance K in Binary Tree_test.go b/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree/863. All Nodes Distance K in Binary Tree_test.go
index 6b6fdda7..766751e0 100644
--- a/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree/863. All Nodes Distance K in Binary Tree_test.go
+++ b/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree/863. All Nodes Distance K in Binary Tree_test.go
@@ -30,7 +30,7 @@ func Test_Problem863(t *testing.T) {
qs := []question863{
- question863{
+ {
para863{[]int{3, 5, 1, 6, 2, 0, 8, structures.NULL, structures.NULL, 7, 4}, []int{5}, 2},
ans863{[]int{7, 4, 1}},
},
diff --git a/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys.go b/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys.go
index 20b77c96..fc34e987 100644
--- a/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys.go
+++ b/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys.go
@@ -6,10 +6,10 @@ import (
)
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
// 解法一 BFS,利用状态压缩来过滤筛选状态
diff --git a/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys_test.go b/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys_test.go
index 5f26e4cb..d1263f37 100644
--- a/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys_test.go
+++ b/leetcode/0864.Shortest-Path-to-Get-All-Keys/864. Shortest Path to Get All Keys_test.go
@@ -26,42 +26,42 @@ func Test_Problem864(t *testing.T) {
qs := []question864{
- question864{
+ {
para864{[]string{".##..##..B", "##...#...#", "..##..#...", ".#..#b...#", "#.##.a.###", ".#....#...", ".##..#.#..", ".....###@.", "..........", ".........A"}},
ans864{11},
},
- question864{
+ {
para864{[]string{"Dd#b@", ".fE.e", "##.B.", "#.cA.", "aF.#C"}},
ans864{14},
},
- question864{
+ {
para864{[]string{"@...a", ".###A", "b.BCc"}},
ans864{10},
},
- question864{
+ {
para864{[]string{"@Aa"}},
ans864{-1},
},
- question864{
+ {
para864{[]string{"b", "A", "a", "@", "B"}},
ans864{3},
},
- question864{
+ {
para864{[]string{"@.a.#", "#####", "b.A.B"}},
ans864{-1},
},
- question864{
+ {
para864{[]string{"@.a.#", "###.#", "b.A.B"}},
ans864{8},
},
- question864{
+ {
para864{[]string{"@..aA", "..B#.", "....b"}},
ans864{6},
},
diff --git a/leetcode/0867.Transpose-Matrix/867. Transpose Matrix_test.go b/leetcode/0867.Transpose-Matrix/867. Transpose Matrix_test.go
index e204553f..508dbaac 100644
--- a/leetcode/0867.Transpose-Matrix/867. Transpose Matrix_test.go
+++ b/leetcode/0867.Transpose-Matrix/867. Transpose Matrix_test.go
@@ -26,14 +26,14 @@ func Test_Problem867(t *testing.T) {
qs := []question867{
- question867{
- para867{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}},
- ans867{[][]int{[]int{1, 4, 7}, []int{2, 5, 8}, []int{3, 6, 9}}},
+ {
+ para867{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}},
+ ans867{[][]int{{1, 4, 7}, {2, 5, 8}, {3, 6, 9}}},
},
- question867{
- para867{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}}},
- ans867{[][]int{[]int{1, 4}, []int{2, 5}, []int{3, 6}}},
+ {
+ para867{[][]int{{1, 2, 3}, {4, 5, 6}}},
+ ans867{[][]int{{1, 4}, {2, 5}, {3, 6}}},
},
}
diff --git a/leetcode/0872.Leaf-Similar-Trees/872. Leaf-Similar Trees_test.go b/leetcode/0872.Leaf-Similar-Trees/872. Leaf-Similar Trees_test.go
index 80ac8bd3..c5eea70b 100644
--- a/leetcode/0872.Leaf-Similar-Trees/872. Leaf-Similar Trees_test.go
+++ b/leetcode/0872.Leaf-Similar-Trees/872. Leaf-Similar Trees_test.go
@@ -29,7 +29,7 @@ func Test_Problem872(t *testing.T) {
qs := []question872{
- question872{
+ {
para872{[]int{-10, -3, 0, 5, 9}, []int{-10, -3, 0, 5, 9}},
ans872{true},
},
diff --git a/leetcode/0875.Koko-Eating-Bananas/875. Koko Eating Bananas_test.go b/leetcode/0875.Koko-Eating-Bananas/875. Koko Eating Bananas_test.go
index f87c0d69..a2a6eba6 100644
--- a/leetcode/0875.Koko-Eating-Bananas/875. Koko Eating Bananas_test.go
+++ b/leetcode/0875.Koko-Eating-Bananas/875. Koko Eating Bananas_test.go
@@ -27,17 +27,17 @@ func Test_Problem875(t *testing.T) {
qs := []question875{
- question875{
+ {
para875{[]int{3, 6, 7, 11}, 8},
ans875{4},
},
- question875{
+ {
para875{[]int{30, 11, 23, 4, 20}, 5},
ans875{30},
},
- question875{
+ {
para875{[]int{30, 11, 23, 4, 20}, 6},
ans875{23},
},
diff --git a/leetcode/0876.Middle-of-the-Linked-List/876. Middle of the Linked List_test.go b/leetcode/0876.Middle-of-the-Linked-List/876. Middle of the Linked List_test.go
index c3c8a96f..93a565dc 100644
--- a/leetcode/0876.Middle-of-the-Linked-List/876. Middle of the Linked List_test.go
+++ b/leetcode/0876.Middle-of-the-Linked-List/876. Middle of the Linked List_test.go
@@ -28,21 +28,21 @@ func Test_Problem876(t *testing.T) {
qs := []question876{
- question876{
+ {
para876{[]int{1, 2, 3, 4, 5}},
ans876{3},
},
- question876{
+ {
para876{[]int{1, 2, 3, 4}},
ans876{3},
},
- question876{
+ {
para876{[]int{1}},
ans876{1},
},
- question876{
+ {
para876{[]int{}},
ans876{},
},
diff --git a/leetcode/0878.Nth-Magical-Number/878. Nth Magical Number_test.go b/leetcode/0878.Nth-Magical-Number/878. Nth Magical Number_test.go
index c917196d..60cdcc0b 100644
--- a/leetcode/0878.Nth-Magical-Number/878. Nth Magical Number_test.go
+++ b/leetcode/0878.Nth-Magical-Number/878. Nth Magical Number_test.go
@@ -28,27 +28,27 @@ func Test_Problem878(t *testing.T) {
qs := []question878{
- question878{
+ {
para878{1, 2, 3},
ans878{2},
},
- question878{
+ {
para878{4, 2, 3},
ans878{6},
},
- question878{
+ {
para878{5, 2, 4},
ans878{10},
},
- question878{
+ {
para878{3, 6, 4},
ans878{8},
},
- question878{
+ {
para878{1000000000, 40000, 40000},
ans878{999720007},
},
diff --git a/leetcode/0880.Decoded-String-at-Index/880. Decoded String at Index_test.go b/leetcode/0880.Decoded-String-at-Index/880. Decoded String at Index_test.go
index 8eeaf89e..016576c9 100644
--- a/leetcode/0880.Decoded-String-at-Index/880. Decoded String at Index_test.go
+++ b/leetcode/0880.Decoded-String-at-Index/880. Decoded String at Index_test.go
@@ -27,32 +27,32 @@ func Test_Problem880(t *testing.T) {
qs := []question880{
- question880{
+ {
para880{"aw4eguc6cs", 41},
ans880{"a"},
},
- question880{
+ {
para880{"vk6u5xhq9v", 554},
ans880{"h"},
},
- question880{
+ {
para880{"leet2code3", 10},
ans880{"o"},
},
- question880{
+ {
para880{"ha22", 5},
ans880{"h"},
},
- question880{
+ {
para880{"a2345678999999999999999", 1},
ans880{"a"},
},
- question880{
+ {
para880{"y959q969u3hb22odq595", 222280369},
ans880{"q"},
},
diff --git a/leetcode/0881.Boats-to-Save-People/881. Boats to Save People_test.go b/leetcode/0881.Boats-to-Save-People/881. Boats to Save People_test.go
index 558eff83..5893f286 100644
--- a/leetcode/0881.Boats-to-Save-People/881. Boats to Save People_test.go
+++ b/leetcode/0881.Boats-to-Save-People/881. Boats to Save People_test.go
@@ -27,27 +27,27 @@ func Test_Problem881(t *testing.T) {
qs := []question881{
- question881{
+ {
para881{[]int{1, 2}, 3},
ans881{1},
},
- question881{
+ {
para881{[]int{3, 2, 2, 1}, 3},
ans881{3},
},
- question881{
+ {
para881{[]int{3, 5, 3, 4}, 5},
ans881{4},
},
- question881{
+ {
para881{[]int{5, 1, 4, 2}, 6},
ans881{2},
},
- question881{
+ {
para881{[]int{3, 2, 2, 1}, 3},
ans881{3},
},
diff --git a/leetcode/0884.Uncommon-Words-from-Two-Sentences/884. Uncommon Words from Two Sentences_test.go b/leetcode/0884.Uncommon-Words-from-Two-Sentences/884. Uncommon Words from Two Sentences_test.go
index ee461865..52d0da9c 100644
--- a/leetcode/0884.Uncommon-Words-from-Two-Sentences/884. Uncommon Words from Two Sentences_test.go
+++ b/leetcode/0884.Uncommon-Words-from-Two-Sentences/884. Uncommon Words from Two Sentences_test.go
@@ -27,12 +27,12 @@ func Test_Problem884(t *testing.T) {
qs := []question884{
- question884{
+ {
para884{"this apple is sweet", "this apple is sour"},
ans884{[]string{"sweet", "sour"}},
},
- question884{
+ {
para884{"apple apple", "banana"},
ans884{[]string{"banana"}},
},
diff --git a/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III.go b/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III.go
index 5e7d8bfd..5ed9e8fc 100644
--- a/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III.go
+++ b/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III.go
@@ -2,10 +2,10 @@ package leetcode
func spiralMatrixIII(R int, C int, r0 int, c0 int) [][]int {
res, round, spDir := [][]int{}, 0, [][]int{
- []int{0, 1}, // 朝右
- []int{1, 0}, // 朝下
- []int{0, -1}, // 朝左
- []int{-1, 0}, // 朝上
+ {0, 1}, // 朝右
+ {1, 0}, // 朝下
+ {0, -1}, // 朝左
+ {-1, 0}, // 朝上
}
res = append(res, []int{r0, c0})
for i := 0; len(res) < R*C; i++ {
diff --git a/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III_test.go b/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III_test.go
index fa45c821..ea2c844a 100644
--- a/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III_test.go
+++ b/leetcode/0885.Spiral-Matrix-III/885. Spiral Matrix III_test.go
@@ -29,16 +29,16 @@ func Test_Problem885(t *testing.T) {
qs := []question885{
- question885{
+ {
para885{1, 4, 0, 0},
- ans885{[][]int{[]int{0, 0}, []int{0, 1}, []int{0, 2}, []int{0, 3}}},
+ ans885{[][]int{{0, 0}, {0, 1}, {0, 2}, {0, 3}}},
},
- question885{
+ {
para885{5, 6, 1, 4},
- ans885{[][]int{[]int{1, 4}, []int{1, 5}, []int{2, 5}, []int{2, 4}, []int{2, 3}, []int{1, 3}, []int{0, 3}, []int{0, 4}, []int{0, 5}, []int{3, 5}, []int{3, 4},
- []int{3, 3}, []int{3, 2}, []int{2, 2}, []int{1, 2}, []int{0, 2}, []int{4, 5}, []int{4, 4}, []int{4, 3}, []int{4, 2}, []int{4, 1}, []int{3, 1}, []int{2, 1},
- []int{1, 1}, []int{0, 1}, []int{4, 0}, []int{3, 0}, []int{2, 0}, []int{1, 0}, []int{0, 0}}},
+ ans885{[][]int{{1, 4}, {1, 5}, {2, 5}, {2, 4}, {2, 3}, {1, 3}, {0, 3}, {0, 4}, {0, 5}, {3, 5}, {3, 4},
+ {3, 3}, {3, 2}, {2, 2}, {1, 2}, {0, 2}, {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {3, 1}, {2, 1},
+ {1, 1}, {0, 1}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}},
},
}
diff --git a/leetcode/0887.Super-Egg-Drop/887. Super Egg Drop_test.go b/leetcode/0887.Super-Egg-Drop/887. Super Egg Drop_test.go
index d59ebad0..1fa604e5 100644
--- a/leetcode/0887.Super-Egg-Drop/887. Super Egg Drop_test.go
+++ b/leetcode/0887.Super-Egg-Drop/887. Super Egg Drop_test.go
@@ -27,17 +27,17 @@ func Test_Problem887(t *testing.T) {
qs := []question887{
- question887{
+ {
para887{1, 2},
ans887{2},
},
- question887{
+ {
para887{2, 6},
ans887{3},
},
- question887{
+ {
para887{3, 14},
ans887{4},
},
diff --git a/leetcode/0888.Fair-Candy-Swap/888. Fair Candy Swap_test.go b/leetcode/0888.Fair-Candy-Swap/888. Fair Candy Swap_test.go
index 227b2878..ef8760ec 100644
--- a/leetcode/0888.Fair-Candy-Swap/888. Fair Candy Swap_test.go
+++ b/leetcode/0888.Fair-Candy-Swap/888. Fair Candy Swap_test.go
@@ -27,27 +27,27 @@ func Test_Problem888(t *testing.T) {
qs := []question888{
- question888{
+ {
para888{[]int{}, []int{}},
ans888{[]int{}},
},
- question888{
+ {
para888{[]int{1, 1}, []int{2, 2}},
ans888{[]int{1, 2}},
},
- question888{
+ {
para888{[]int{1, 2}, []int{2, 3}},
ans888{[]int{1, 2}},
},
- question888{
+ {
para888{[]int{2}, []int{1, 3}},
ans888{[]int{2, 3}},
},
- question888{
+ {
para888{[]int{1, 2, 5}, []int{2, 4}},
ans888{[]int{5, 4}},
},
diff --git a/leetcode/0891.Sum-of-Subsequence-Widths/891. Sum of Subsequence Widths_test.go b/leetcode/0891.Sum-of-Subsequence-Widths/891. Sum of Subsequence Widths_test.go
index 6a0481dc..4fa59015 100644
--- a/leetcode/0891.Sum-of-Subsequence-Widths/891. Sum of Subsequence Widths_test.go
+++ b/leetcode/0891.Sum-of-Subsequence-Widths/891. Sum of Subsequence Widths_test.go
@@ -26,12 +26,12 @@ func Test_Problem891(t *testing.T) {
qs := []question891{
- question891{
+ {
para891{[]int{2, 1, 3}},
ans891{6},
},
- question891{
+ {
para891{[]int{3, 7, 2, 3}},
ans891{35},
},
diff --git a/leetcode/0892.Surface-Area-of-3D-Shapes/892. Surface Area of 3D Shapes_test.go b/leetcode/0892.Surface-Area-of-3D-Shapes/892. Surface Area of 3D Shapes_test.go
index e487bf96..79aa2d11 100644
--- a/leetcode/0892.Surface-Area-of-3D-Shapes/892. Surface Area of 3D Shapes_test.go
+++ b/leetcode/0892.Surface-Area-of-3D-Shapes/892. Surface Area of 3D Shapes_test.go
@@ -26,28 +26,28 @@ func Test_Problem892(t *testing.T) {
qs := []question892{
- question892{
- para892{[][]int{[]int{2}}},
+ {
+ para892{[][]int{{2}}},
ans892{10},
},
- question892{
- para892{[][]int{[]int{1, 2}, []int{3, 4}}},
+ {
+ para892{[][]int{{1, 2}, {3, 4}}},
ans892{34},
},
- question892{
- para892{[][]int{[]int{1, 0}, []int{0, 2}}},
+ {
+ para892{[][]int{{1, 0}, {0, 2}}},
ans892{16},
},
- question892{
- para892{[][]int{[]int{1, 1, 1}, []int{1, 0, 1}, []int{1, 1, 1}}},
+ {
+ para892{[][]int{{1, 1, 1}, {1, 0, 1}, {1, 1, 1}}},
ans892{32},
},
- question892{
- para892{[][]int{[]int{2, 2, 2}, []int{2, 1, 2}, []int{2, 2, 2}}},
+ {
+ para892{[][]int{{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}},
ans892{46},
},
}
diff --git a/leetcode/0896.Monotonic-Array/896. Monotonic Array_test.go b/leetcode/0896.Monotonic-Array/896. Monotonic Array_test.go
index 38a54fa7..2b111205 100644
--- a/leetcode/0896.Monotonic-Array/896. Monotonic Array_test.go
+++ b/leetcode/0896.Monotonic-Array/896. Monotonic Array_test.go
@@ -26,32 +26,32 @@ func Test_Problem896(t *testing.T) {
qs := []question896{
- question896{
+ {
para896{[]int{2, 1, 3}},
ans896{false},
},
- question896{
+ {
para896{[]int{1, 2, 2, 3}},
ans896{true},
},
- question896{
+ {
para896{[]int{6, 5, 4, 4}},
ans896{true},
},
- question896{
+ {
para896{[]int{1, 3, 2}},
ans896{false},
},
- question896{
+ {
para896{[]int{1, 2, 4, 5}},
ans896{true},
},
- question896{
+ {
para896{[]int{1, 1, 1}},
ans896{true},
},
diff --git a/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree.go b/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree.go
index 68d2ad6a..2d4070e0 100644
--- a/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree.go
+++ b/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree.go
@@ -37,12 +37,12 @@ func recBST(root, tail *TreeNode) *TreeNode {
// 解法二 模拟
func increasingBST1(root *TreeNode) *TreeNode {
- list, newRoot := []int{}, &TreeNode{}
+ list := []int{}
inorder(root, &list)
if len(list) == 0 {
return root
}
- newRoot = &TreeNode{Val: list[0], Left: nil, Right: nil}
+ newRoot := &TreeNode{Val: list[0], Left: nil, Right: nil}
cur := newRoot
for index := 1; index < len(list); index++ {
tmp := &TreeNode{Val: list[index], Left: nil, Right: nil}
diff --git a/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree_test.go b/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree_test.go
index 53e4af2b..b92a97f1 100644
--- a/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree_test.go
+++ b/leetcode/0897.Increasing-Order-Search-Tree/897. Increasing Order Search Tree_test.go
@@ -28,42 +28,42 @@ func Test_Problem897(t *testing.T) {
qs := []question897{
- question897{
+ {
para897{[]int{5, 3, 6, 2, 4, structures.NULL, 8, 1, structures.NULL, structures.NULL, structures.NULL, 7, 9}},
ans897{[]int{1, structures.NULL, 2, structures.NULL, 3, structures.NULL, 4, structures.NULL, 5, structures.NULL, 6, structures.NULL, 7, structures.NULL, 8, structures.NULL, 9}},
},
- question897{
+ {
para897{[]int{3, 4, 4, 5, structures.NULL, structures.NULL, 5, 6, structures.NULL, structures.NULL, 6}},
ans897{[]int{6, structures.NULL, 5, structures.NULL, 4, structures.NULL, 3, structures.NULL, 4, structures.NULL, 5, structures.NULL, 6}},
},
- question897{
+ {
para897{[]int{1, 2, 2, structures.NULL, 3, 3}},
ans897{[]int{2, structures.NULL, 3, structures.NULL, 1, structures.NULL, 3, structures.NULL, 2}},
},
- question897{
+ {
para897{[]int{}},
ans897{[]int{}},
},
- question897{
+ {
para897{[]int{1}},
ans897{[]int{1}},
},
- question897{
+ {
para897{[]int{1, 2, 3}},
ans897{[]int{2, structures.NULL, 1, structures.NULL, 3}},
},
- question897{
+ {
para897{[]int{1, 2, 2, 3, 4, 4, 3}},
ans897{[]int{3, structures.NULL, 2, structures.NULL, 4, structures.NULL, 1, structures.NULL, 4, structures.NULL, 2, structures.NULL, 3}},
},
- question897{
+ {
para897{[]int{1, 2, 2, structures.NULL, 3, structures.NULL, 3}},
ans897{[]int{2, structures.NULL, 3, structures.NULL, 1, structures.NULL, 2, structures.NULL, 3}},
},
diff --git a/leetcode/0898.Bitwise-ORs-of-Subarrays/898. Bitwise ORs of Subarrays_test.go b/leetcode/0898.Bitwise-ORs-of-Subarrays/898. Bitwise ORs of Subarrays_test.go
index 5387263b..7c81c146 100644
--- a/leetcode/0898.Bitwise-ORs-of-Subarrays/898. Bitwise ORs of Subarrays_test.go
+++ b/leetcode/0898.Bitwise-ORs-of-Subarrays/898. Bitwise ORs of Subarrays_test.go
@@ -26,17 +26,17 @@ func Test_Problem898(t *testing.T) {
qs := []question898{
- question898{
+ {
para898{[]int{0}},
ans898{1},
},
- question898{
+ {
para898{[]int{1, 1, 2}},
ans898{3},
},
- question898{
+ {
para898{[]int{1, 2, 4}},
ans898{6},
},
diff --git a/leetcode/0904.Fruit-Into-Baskets/904. Fruit Into Baskets_test.go b/leetcode/0904.Fruit-Into-Baskets/904. Fruit Into Baskets_test.go
index c8201408..ade6eb94 100644
--- a/leetcode/0904.Fruit-Into-Baskets/904. Fruit Into Baskets_test.go
+++ b/leetcode/0904.Fruit-Into-Baskets/904. Fruit Into Baskets_test.go
@@ -26,41 +26,41 @@ func Test_Problem904(t *testing.T) {
qs := []question904{
- question904{
+ {
para904{[]int{1, 1}},
ans904{2},
},
- question904{
+ {
para904{[]int{1, 2, 1}},
ans904{3},
},
- question904{
+ {
para904{[]int{0, 1, 2, 2}},
ans904{3},
},
- question904{
+ {
para904{[]int{1, 2, 3, 2, 2}},
ans904{4},
},
- question904{
+ {
para904{[]int{3, 3, 3, 1, 2, 1, 1, 2, 3, 3, 4}},
ans904{5},
},
- question904{
+ {
para904{[]int{4, 5}},
ans904{2},
},
- question904{
+ {
para904{[]int{1}},
ans904{1},
},
- question904{
+ {
para904{[]int{}},
ans904{},
},
diff --git a/leetcode/0907.Sum-of-Subarray-Minimums/907. Sum of Subarray Minimums_test.go b/leetcode/0907.Sum-of-Subarray-Minimums/907. Sum of Subarray Minimums_test.go
index 01b2eb58..b21f74fd 100644
--- a/leetcode/0907.Sum-of-Subarray-Minimums/907. Sum of Subarray Minimums_test.go
+++ b/leetcode/0907.Sum-of-Subarray-Minimums/907. Sum of Subarray Minimums_test.go
@@ -26,7 +26,7 @@ func Test_Problem907(t *testing.T) {
qs := []question907{
- question907{
+ {
para907{[]int{3, 1, 2, 4}},
ans907{17},
},
diff --git a/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards/914. X of a Kind in a Deck of Cards_test.go b/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards/914. X of a Kind in a Deck of Cards_test.go
index 598daee8..3372ee55 100644
--- a/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards/914. X of a Kind in a Deck of Cards_test.go
+++ b/leetcode/0914.X-of-a-Kind-in-a-Deck-of-Cards/914. X of a Kind in a Deck of Cards_test.go
@@ -26,27 +26,27 @@ func Test_Problem914(t *testing.T) {
qs := []question914{
- question914{
+ {
para914{[]int{1, 2, 3, 4, 4, 3, 2, 1}},
ans914{true},
},
- question914{
+ {
para914{[]int{1, 1, 1, 2, 2, 2, 3, 3}},
ans914{false},
},
- question914{
+ {
para914{[]int{1}},
ans914{false},
},
- question914{
+ {
para914{[]int{1, 1}},
ans914{true},
},
- question914{
+ {
para914{[]int{1, 1, 2, 2, 2, 2}},
ans914{true},
},
diff --git a/leetcode/0918.Maximum-Sum-Circular-Subarray/918. Maximum Sum Circular Subarray_test.go b/leetcode/0918.Maximum-Sum-Circular-Subarray/918. Maximum Sum Circular Subarray_test.go
index b601a8ed..f7d25c08 100644
--- a/leetcode/0918.Maximum-Sum-Circular-Subarray/918. Maximum Sum Circular Subarray_test.go
+++ b/leetcode/0918.Maximum-Sum-Circular-Subarray/918. Maximum Sum Circular Subarray_test.go
@@ -26,27 +26,27 @@ func Test_Problem918(t *testing.T) {
qs := []question918{
- question918{
+ {
para918{[]int{1, -2, 3, -2}},
ans918{3},
},
- question918{
+ {
para918{[]int{5, -3, 5}},
ans918{10},
},
- question918{
+ {
para918{[]int{3, -1, 2, -1}},
ans918{4},
},
- question918{
+ {
para918{[]int{3, -2, 2, -3}},
ans918{3},
},
- question918{
+ {
para918{[]int{-2, -3, -1}},
ans918{-1},
},
diff --git a/leetcode/0920.Number-of-Music-Playlists/920. Number of Music Playlists_test.go b/leetcode/0920.Number-of-Music-Playlists/920. Number of Music Playlists_test.go
index e51c67d2..39ed3511 100644
--- a/leetcode/0920.Number-of-Music-Playlists/920. Number of Music Playlists_test.go
+++ b/leetcode/0920.Number-of-Music-Playlists/920. Number of Music Playlists_test.go
@@ -28,17 +28,17 @@ func Test_Problem920(t *testing.T) {
qs := []question920{
- question920{
+ {
para920{3, 3, 1},
ans920{6},
},
- question920{
+ {
para920{2, 3, 0},
ans920{6},
},
- question920{
+ {
para920{2, 3, 1},
ans920{2},
},
diff --git a/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid/921. Minimum Add to Make Parentheses Valid_test.go b/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid/921. Minimum Add to Make Parentheses Valid_test.go
index c1be5eee..24e5c55b 100644
--- a/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid/921. Minimum Add to Make Parentheses Valid_test.go
+++ b/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid/921. Minimum Add to Make Parentheses Valid_test.go
@@ -25,22 +25,22 @@ type ans921 struct {
func Test_Problem921(t *testing.T) {
qs := []question921{
- question921{
+ {
para921{"())"},
ans921{1},
},
- question921{
+ {
para921{"((("},
ans921{3},
},
- question921{
+ {
para921{"()"},
ans921{0},
},
- question921{
+ {
para921{"()))(("},
ans921{4},
},
diff --git a/leetcode/0922.Sort-Array-By-Parity-II/922. Sort Array By Parity II_test.go b/leetcode/0922.Sort-Array-By-Parity-II/922. Sort Array By Parity II_test.go
index 92a4277e..235e0602 100644
--- a/leetcode/0922.Sort-Array-By-Parity-II/922. Sort Array By Parity II_test.go
+++ b/leetcode/0922.Sort-Array-By-Parity-II/922. Sort Array By Parity II_test.go
@@ -26,17 +26,17 @@ func Test_Problem922(t *testing.T) {
qs := []question922{
- question922{
+ {
para922{[]int{}},
ans922{[]int{}},
},
- question922{
+ {
para922{[]int{1}},
ans922{[]int{}},
},
- question922{
+ {
para922{[]int{4, 2, 5, 7}},
ans922{[]int{4, 5, 2, 7}},
},
diff --git a/leetcode/0923.3Sum-With-Multiplicity/923. 3Sum With Multiplicity_test.go b/leetcode/0923.3Sum-With-Multiplicity/923. 3Sum With Multiplicity_test.go
index d01c4218..50550956 100644
--- a/leetcode/0923.3Sum-With-Multiplicity/923. 3Sum With Multiplicity_test.go
+++ b/leetcode/0923.3Sum-With-Multiplicity/923. 3Sum With Multiplicity_test.go
@@ -27,12 +27,12 @@ func Test_Problem923(t *testing.T) {
qs := []question923{
- question923{
+ {
para923{[]int{1, 1, 2, 2, 3, 3, 4, 4, 5, 5}, 8},
ans923{20},
},
- question923{
+ {
para923{[]int{1, 1, 2, 2, 2, 2}, 5},
ans923{12},
},
diff --git a/leetcode/0924.Minimize-Malware-Spread/924. Minimize Malware Spread_test.go b/leetcode/0924.Minimize-Malware-Spread/924. Minimize Malware Spread_test.go
index 6973f0d8..8c9576e6 100644
--- a/leetcode/0924.Minimize-Malware-Spread/924. Minimize Malware Spread_test.go
+++ b/leetcode/0924.Minimize-Malware-Spread/924. Minimize Malware Spread_test.go
@@ -27,28 +27,28 @@ func Test_Problem924(t *testing.T) {
qs := []question924{
- question924{
- para924{[][]int{[]int{1, 0, 0, 0}, []int{0, 1, 0, 0}, []int{0, 0, 1, 1}, []int{0, 0, 1, 1}}, []int{3, 1}},
+ {
+ para924{[][]int{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 1}, {0, 0, 1, 1}}, []int{3, 1}},
ans924{3},
},
- question924{
- para924{[][]int{[]int{1, 0, 0, 0, 0, 0}, []int{0, 1, 0, 0, 0, 0}, []int{0, 0, 1, 0, 0, 0}, []int{0, 0, 0, 1, 1, 0}, []int{0, 0, 0, 1, 1, 0}, []int{0, 0, 0, 0, 0, 1}}, []int{5, 0}},
+ {
+ para924{[][]int{{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 0, 1}}, []int{5, 0}},
ans924{0},
},
- question924{
- para924{[][]int{[]int{1, 1, 1}, []int{1, 1, 1}, []int{1, 1, 1}}, []int{1, 2}},
+ {
+ para924{[][]int{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, []int{1, 2}},
ans924{1},
},
- question924{
- para924{[][]int{[]int{1, 1, 0}, []int{1, 1, 0}, []int{0, 0, 1}}, []int{0, 1}},
+ {
+ para924{[][]int{{1, 1, 0}, {1, 1, 0}, {0, 0, 1}}, []int{0, 1}},
ans924{0},
},
- question924{
- para924{[][]int{[]int{1, 0, 0}, []int{0, 1, 0}, []int{0, 0, 1}}, []int{0, 2}},
+ {
+ para924{[][]int{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, []int{0, 2}},
ans924{0},
},
}
diff --git a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go
index 31c7ce67..f374c797 100644
--- a/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go
+++ b/leetcode/0925.Long-Pressed-Name/925. Long Pressed Name_test.go
@@ -27,27 +27,27 @@ func Test_Problem925(t *testing.T) {
qs := []question925{
- question925{
+ {
para925{"alex", "aaleex"},
ans925{true},
},
- question925{
+ {
para925{"saeed", "ssaaedd"},
ans925{false},
},
- question925{
+ {
para925{"leelee", "lleeelee"},
ans925{true},
},
- question925{
+ {
para925{"laiden", "laiden"},
ans925{true},
},
- question925{
+ {
para925{"kikcxmvzi", "kiikcxxmmvvzz"},
ans925{false},
},
diff --git a/leetcode/0927.Three-Equal-Parts/927. Three Equal Parts_test.go b/leetcode/0927.Three-Equal-Parts/927. Three Equal Parts_test.go
index f6d23034..5b376459 100644
--- a/leetcode/0927.Three-Equal-Parts/927. Three Equal Parts_test.go
+++ b/leetcode/0927.Three-Equal-Parts/927. Three Equal Parts_test.go
@@ -26,12 +26,12 @@ func Test_Problem927(t *testing.T) {
qs := []question927{
- question927{
+ {
para927{[]int{1, 0, 1, 0, 1}},
ans927{[]int{0, 3}},
},
- question927{
+ {
para927{[]int{1, 1, 0, 1, 1}},
ans927{[]int{-1, -1}},
},
diff --git a/leetcode/0928.Minimize-Malware-Spread-II/928. Minimize Malware Spread II_test.go b/leetcode/0928.Minimize-Malware-Spread-II/928. Minimize Malware Spread II_test.go
index 7d8552c2..b05bb162 100644
--- a/leetcode/0928.Minimize-Malware-Spread-II/928. Minimize Malware Spread II_test.go
+++ b/leetcode/0928.Minimize-Malware-Spread-II/928. Minimize Malware Spread II_test.go
@@ -27,37 +27,37 @@ func Test_Problem928(t *testing.T) {
qs := []question928{
- question928{
- para928{[][]int{[]int{1, 0, 0, 0}, []int{0, 1, 1, 1}, []int{0, 1, 1, 0}, []int{0, 1, 0, 1}}, []int{1, 3}},
+ {
+ para928{[][]int{{1, 0, 0, 0}, {0, 1, 1, 1}, {0, 1, 1, 0}, {0, 1, 0, 1}}, []int{1, 3}},
ans928{1},
},
- question928{
- para928{[][]int{[]int{1, 1, 1, 0}, []int{1, 1, 0, 0}, []int{1, 0, 1, 0}, []int{0, 0, 0, 1}}, []int{3, 2}},
+ {
+ para928{[][]int{{1, 1, 1, 0}, {1, 1, 0, 0}, {1, 0, 1, 0}, {0, 0, 0, 1}}, []int{3, 2}},
ans928{2},
},
- question928{
- para928{[][]int{[]int{1, 1, 0}, []int{1, 1, 1}, []int{0, 1, 1}}, []int{0, 1}},
+ {
+ para928{[][]int{{1, 1, 0}, {1, 1, 1}, {0, 1, 1}}, []int{0, 1}},
ans928{1},
},
- question928{
- para928{[][]int{[]int{1, 1, 0}, []int{1, 1, 0}, []int{0, 0, 1}}, []int{0, 1}},
+ {
+ para928{[][]int{{1, 1, 0}, {1, 1, 0}, {0, 0, 1}}, []int{0, 1}},
ans928{0},
},
- question928{
- para928{[][]int{[]int{1, 1, 0, 0}, []int{1, 1, 1, 0}, []int{0, 1, 1, 1}, []int{0, 0, 1, 1}}, []int{0, 1}},
+ {
+ para928{[][]int{{1, 1, 0, 0}, {1, 1, 1, 0}, {0, 1, 1, 1}, {0, 0, 1, 1}}, []int{0, 1}},
ans928{1},
},
- question928{
- para928{[][]int{[]int{1, 0, 0, 0}, []int{0, 1, 0, 0}, []int{0, 0, 1, 1}, []int{0, 0, 1, 1}}, []int{3, 1}},
+ {
+ para928{[][]int{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 1}, {0, 0, 1, 1}}, []int{3, 1}},
ans928{3},
},
- question928{
- para928{[][]int{[]int{1, 0, 0, 0, 0, 0}, []int{0, 1, 0, 0, 0, 0}, []int{0, 0, 1, 0, 0, 0}, []int{0, 0, 0, 1, 1, 0}, []int{0, 0, 0, 1, 1, 0}, []int{0, 0, 0, 0, 0, 1}}, []int{5, 0}},
+ {
+ para928{[][]int{{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 0, 1}}, []int{5, 0}},
ans928{0},
},
}
diff --git a/leetcode/0930.Binary-Subarrays-With-Sum/930. Binary Subarrays With Sum_test.go b/leetcode/0930.Binary-Subarrays-With-Sum/930. Binary Subarrays With Sum_test.go
index 788653ad..e51d634a 100644
--- a/leetcode/0930.Binary-Subarrays-With-Sum/930. Binary Subarrays With Sum_test.go
+++ b/leetcode/0930.Binary-Subarrays-With-Sum/930. Binary Subarrays With Sum_test.go
@@ -27,17 +27,17 @@ func Test_Problem930(t *testing.T) {
qs := []question930{
- question930{
+ {
para930{[]int{1, 0, 1, 0, 1}, 2},
ans930{4},
},
- question930{
+ {
para930{[]int{0, 0, 0, 0, 0}, 0},
ans930{15},
},
- question930{
+ {
para930{[]int{1, 0, 1, 1, 1, 1, 0, 1, 0, 1}, 2},
ans930{4},
},
diff --git a/leetcode/0942.DI-String-Match/942. DI String Match_test.go b/leetcode/0942.DI-String-Match/942. DI String Match_test.go
index c0767e32..4b34dd95 100644
--- a/leetcode/0942.DI-String-Match/942. DI String Match_test.go
+++ b/leetcode/0942.DI-String-Match/942. DI String Match_test.go
@@ -26,17 +26,17 @@ func Test_Problem942(t *testing.T) {
qs := []question942{
- question942{
+ {
para942{"IDID"},
ans942{[]int{0, 4, 1, 3, 2}},
},
- question942{
+ {
para942{"III"},
ans942{[]int{0, 1, 2, 3}},
},
- question942{
+ {
para942{"DDI"},
ans942{[]int{3, 2, 0, 1}},
},
diff --git a/leetcode/0946.Validate-Stack-Sequences/946. Validate Stack Sequences_test.go b/leetcode/0946.Validate-Stack-Sequences/946. Validate Stack Sequences_test.go
index 3605c43c..51c8842f 100644
--- a/leetcode/0946.Validate-Stack-Sequences/946. Validate Stack Sequences_test.go
+++ b/leetcode/0946.Validate-Stack-Sequences/946. Validate Stack Sequences_test.go
@@ -26,17 +26,17 @@ type ans946 struct {
func Test_Problem946(t *testing.T) {
qs := []question946{
- question946{
+ {
para946{[]int{1, 2, 3, 4, 5}, []int{5, 4, 3, 2, 1}},
ans946{true},
},
- question946{
+ {
para946{[]int{1, 2, 3, 4, 5}, []int{4, 3, 5, 1, 2}},
ans946{false},
},
- question946{
+ {
para946{[]int{1, 0}, []int{1, 0}},
ans946{true},
},
diff --git a/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column/947. Most Stones Removed with Same Row or Column_test.go b/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column/947. Most Stones Removed with Same Row or Column_test.go
index 54328dce..c77f1abe 100644
--- a/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column/947. Most Stones Removed with Same Row or Column_test.go
+++ b/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column/947. Most Stones Removed with Same Row or Column_test.go
@@ -25,18 +25,18 @@ type ans947 struct {
func Test_Problem947(t *testing.T) {
qs := []question947{
- question947{
- para947{[][]int{[]int{0, 0}, []int{0, 1}, []int{1, 0}, []int{1, 2}, []int{2, 1}, []int{2, 2}}},
+ {
+ para947{[][]int{{0, 0}, {0, 1}, {1, 0}, {1, 2}, {2, 1}, {2, 2}}},
ans947{5},
},
- question947{
- para947{[][]int{[]int{0, 0}, []int{0, 2}, []int{1, 1}, []int{2, 0}, []int{2, 2}}},
+ {
+ para947{[][]int{{0, 0}, {0, 2}, {1, 1}, {2, 0}, {2, 2}}},
ans947{3},
},
- question947{
- para947{[][]int{[]int{0, 0}}},
+ {
+ para947{[][]int{{0, 0}}},
ans947{0},
},
}
diff --git a/leetcode/0949.Largest-Time-for-Given-Digits/949. Largest Time for Given Digits_test.go b/leetcode/0949.Largest-Time-for-Given-Digits/949. Largest Time for Given Digits_test.go
index 782f779b..29bbfa04 100644
--- a/leetcode/0949.Largest-Time-for-Given-Digits/949. Largest Time for Given Digits_test.go
+++ b/leetcode/0949.Largest-Time-for-Given-Digits/949. Largest Time for Given Digits_test.go
@@ -25,12 +25,12 @@ type ans949 struct {
func Test_Problem949(t *testing.T) {
qs := []question949{
- question949{
+ {
para949{[]int{1, 2, 3, 4}},
ans949{"23:41"},
},
- question949{
+ {
para949{[]int{5, 5, 5, 5}},
ans949{""},
},
diff --git a/leetcode/0952.Largest-Component-Size-by-Common-Factor/952. Largest Component Size by Common Factor_test.go b/leetcode/0952.Largest-Component-Size-by-Common-Factor/952. Largest Component Size by Common Factor_test.go
index 7c05beb7..b2394286 100644
--- a/leetcode/0952.Largest-Component-Size-by-Common-Factor/952. Largest Component Size by Common Factor_test.go
+++ b/leetcode/0952.Largest-Component-Size-by-Common-Factor/952. Largest Component Size by Common Factor_test.go
@@ -25,22 +25,22 @@ type ans952 struct {
func Test_Problem952(t *testing.T) {
qs := []question952{
- question952{
+ {
para952{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9}},
ans952{6},
},
- question952{
+ {
para952{[]int{4, 6, 15, 35}},
ans952{4},
},
- question952{
+ {
para952{[]int{20, 50, 9, 63}},
ans952{2},
},
- question952{
+ {
para952{[]int{2, 3, 6, 7, 4, 12, 21, 39}},
ans952{8},
},
diff --git a/leetcode/0953.Verifying-an-Alien-Dictionary/953. Verifying an Alien Dictionary_test.go b/leetcode/0953.Verifying-an-Alien-Dictionary/953. Verifying an Alien Dictionary_test.go
index a20b82b6..6bb2be8a 100644
--- a/leetcode/0953.Verifying-an-Alien-Dictionary/953. Verifying an Alien Dictionary_test.go
+++ b/leetcode/0953.Verifying-an-Alien-Dictionary/953. Verifying an Alien Dictionary_test.go
@@ -26,17 +26,17 @@ type ans953 struct {
func Test_Problem953(t *testing.T) {
qs := []question953{
- question953{
+ {
para953{[]string{"hello", "leetcode"}, "hlabcdefgijkmnopqrstuvwxyz"},
ans953{true},
},
- question953{
+ {
para953{[]string{"word", "world", "row"}, "worldabcefghijkmnpqstuvxyz"},
ans953{false},
},
- question953{
+ {
para953{[]string{"apple", "app"}, "abcdefghijklmnopqrstuvwxyz"},
ans953{false},
},
diff --git a/leetcode/0959.Regions-Cut-By-Slashes/959. Regions Cut By Slashes_test.go b/leetcode/0959.Regions-Cut-By-Slashes/959. Regions Cut By Slashes_test.go
index ec978a55..51a088ed 100644
--- a/leetcode/0959.Regions-Cut-By-Slashes/959. Regions Cut By Slashes_test.go
+++ b/leetcode/0959.Regions-Cut-By-Slashes/959. Regions Cut By Slashes_test.go
@@ -25,27 +25,27 @@ type ans959 struct {
func Test_Problem959(t *testing.T) {
qs := []question959{
- question959{
+ {
para959{[]string{" /", "/ "}},
ans959{2},
},
- question959{
+ {
para959{[]string{" /", " "}},
ans959{1},
},
- question959{
+ {
para959{[]string{"\\/", "/\\"}},
ans959{4},
},
- question959{
+ {
para959{[]string{"/\\", "\\/"}},
ans959{5},
},
- question959{
+ {
para959{[]string{"//", "/ "}},
ans959{3},
},
diff --git a/leetcode/0961.N-Repeated-Element-in-Size-2N-Array/961. N-Repeated Element in Size 2N Array_test.go b/leetcode/0961.N-Repeated-Element-in-Size-2N-Array/961. N-Repeated Element in Size 2N Array_test.go
index f101197a..cadc95a7 100644
--- a/leetcode/0961.N-Repeated-Element-in-Size-2N-Array/961. N-Repeated Element in Size 2N Array_test.go
+++ b/leetcode/0961.N-Repeated-Element-in-Size-2N-Array/961. N-Repeated Element in Size 2N Array_test.go
@@ -25,17 +25,17 @@ type ans961 struct {
func Test_Problem961(t *testing.T) {
qs := []question961{
- question961{
+ {
para961{[]int{1, 2, 3, 3}},
ans961{3},
},
- question961{
+ {
para961{[]int{2, 1, 2, 5, 3, 2}},
ans961{2},
},
- question961{
+ {
para961{[]int{5, 1, 5, 2, 5, 3, 5, 4}},
ans961{5},
},
diff --git a/leetcode/0968.Binary-Tree-Cameras/968. Binary Tree Cameras_test.go b/leetcode/0968.Binary-Tree-Cameras/968. Binary Tree Cameras_test.go
index 5f8971bd..9ab69d56 100644
--- a/leetcode/0968.Binary-Tree-Cameras/968. Binary Tree Cameras_test.go
+++ b/leetcode/0968.Binary-Tree-Cameras/968. Binary Tree Cameras_test.go
@@ -28,12 +28,12 @@ func Test_Problem968(t *testing.T) {
qs := []question968{
- question968{
+ {
para968{[]int{0, 0, structures.NULL, 0, 0}},
ans968{1},
},
- question968{
+ {
para968{[]int{0, 0, structures.NULL, 0, structures.NULL, 0, structures.NULL, structures.NULL, 0}},
ans968{2},
},
diff --git a/leetcode/0969.Pancake-Sorting/969. Pancake Sorting_test.go b/leetcode/0969.Pancake-Sorting/969. Pancake Sorting_test.go
index b44b3722..d2225393 100644
--- a/leetcode/0969.Pancake-Sorting/969. Pancake Sorting_test.go
+++ b/leetcode/0969.Pancake-Sorting/969. Pancake Sorting_test.go
@@ -26,17 +26,17 @@ func Test_Problem969(t *testing.T) {
qs := []question969{
- question969{
+ {
para969{[]int{}},
ans969{[]int{}},
},
- question969{
+ {
para969{[]int{1}},
ans969{[]int{1}},
},
- question969{
+ {
para969{[]int{3, 2, 4, 1}},
ans969{[]int{3, 4, 2, 3, 1, 2}},
},
diff --git a/leetcode/0970.Powerful-Integers/970. Powerful Integers_test.go b/leetcode/0970.Powerful-Integers/970. Powerful Integers_test.go
index 82eb8fdd..6501a364 100644
--- a/leetcode/0970.Powerful-Integers/970. Powerful Integers_test.go
+++ b/leetcode/0970.Powerful-Integers/970. Powerful Integers_test.go
@@ -28,12 +28,12 @@ func Test_Problem970(t *testing.T) {
qs := []question970{
- question970{
+ {
para970{2, 3, 10},
ans970{[]int{2, 3, 4, 5, 7, 9, 10}},
},
- question970{
+ {
para970{3, 5, 15},
ans970{[]int{2, 4, 6, 8, 10, 14}},
},
diff --git a/leetcode/0973.K-Closest-Points-to-Origin/973. K Closest Points to Origin_test.go b/leetcode/0973.K-Closest-Points-to-Origin/973. K Closest Points to Origin_test.go
index a5cc9d62..6ea66d66 100644
--- a/leetcode/0973.K-Closest-Points-to-Origin/973. K Closest Points to Origin_test.go
+++ b/leetcode/0973.K-Closest-Points-to-Origin/973. K Closest Points to Origin_test.go
@@ -27,24 +27,24 @@ func Test_Problem973(t *testing.T) {
qs := []question973{
- question973{
- para973{[][]int{[]int{1, 3}, []int{-2, 2}}, 1},
- ans973{[][]int{[]int{-2, 2}}},
+ {
+ para973{[][]int{{1, 3}, {-2, 2}}, 1},
+ ans973{[][]int{{-2, 2}}},
},
- question973{
- para973{[][]int{[]int{1, 3}, []int{-2, 2}}, 0},
- ans973{[][]int{[]int{}}},
+ {
+ para973{[][]int{{1, 3}, {-2, 2}}, 0},
+ ans973{[][]int{{}}},
},
- question973{
- para973{[][]int{[]int{3, 3}, []int{5, -1}, []int{-2, 4}}, 2},
- ans973{[][]int{[]int{3, 3}, []int{-2, 4}}},
+ {
+ para973{[][]int{{3, 3}, {5, -1}, {-2, 4}}, 2},
+ ans973{[][]int{{3, 3}, {-2, 4}}},
},
- question973{
- para973{[][]int{[]int{0, 1}, []int{1, 0}}, 2},
- ans973{[][]int{[]int{1, 0}, []int{0, 1}}},
+ {
+ para973{[][]int{{0, 1}, {1, 0}}, 2},
+ ans973{[][]int{{1, 0}, {0, 1}}},
},
}
diff --git a/leetcode/0976.Largest-Perimeter-Triangle/976. Largest Perimeter Triangle_test.go b/leetcode/0976.Largest-Perimeter-Triangle/976. Largest Perimeter Triangle_test.go
index e16e9a5e..e044f42b 100644
--- a/leetcode/0976.Largest-Perimeter-Triangle/976. Largest Perimeter Triangle_test.go
+++ b/leetcode/0976.Largest-Perimeter-Triangle/976. Largest Perimeter Triangle_test.go
@@ -26,36 +26,36 @@ func Test_Problem976(t *testing.T) {
qs := []question976{
- question976{
+ {
para976{[]int{1, 2}},
ans976{0},
},
- question976{
+ {
para976{[]int{1, 2, 3}},
ans976{0},
},
- question976{
+ {
para976{[]int{}},
ans976{0},
},
- question976{
+ {
para976{[]int{2, 1, 2}},
ans976{5},
},
- question976{
+ {
para976{[]int{1, 1, 2}},
ans976{0},
},
- question976{
+ {
para976{[]int{3, 2, 3, 4}},
ans976{10},
},
- question976{
+ {
para976{[]int{3, 6, 2, 3}},
ans976{8},
},
diff --git a/leetcode/0977.Squares-of-a-Sorted-Array/977. Squares of a Sorted Array_test.go b/leetcode/0977.Squares-of-a-Sorted-Array/977. Squares of a Sorted Array_test.go
index 33e49b1d..01b7c9c9 100644
--- a/leetcode/0977.Squares-of-a-Sorted-Array/977. Squares of a Sorted Array_test.go
+++ b/leetcode/0977.Squares-of-a-Sorted-Array/977. Squares of a Sorted Array_test.go
@@ -26,17 +26,17 @@ func Test_Problem977(t *testing.T) {
qs := []question977{
- question977{
+ {
para977{[]int{-4, -1, 0, 3, 10}},
ans977{[]int{0, 1, 9, 16, 100}},
},
- question977{
+ {
para977{[]int{1}},
ans977{[]int{1}},
},
- question977{
+ {
para977{[]int{-7, -3, 2, 3, 11}},
ans977{[]int{4, 9, 9, 49, 121}},
},
diff --git a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray_test.go b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray_test.go
index cd3c1e80..cd16e06b 100644
--- a/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray_test.go
+++ b/leetcode/0978.Longest-Turbulent-Subarray/978. Longest Turbulent Subarray_test.go
@@ -26,27 +26,27 @@ func Test_Problem978(t *testing.T) {
qs := []question978{
- question978{
+ {
para978{[]int{0, 1, 1, 0, 1, 0, 1, 1, 0, 0}},
ans978{5},
},
- question978{
+ {
para978{[]int{9, 9}},
ans978{1},
},
- question978{
+ {
para978{[]int{9, 4, 2, 10, 7, 8, 8, 1, 9}},
ans978{5},
},
- question978{
+ {
para978{[]int{4, 8, 12, 16}},
ans978{2},
},
- question978{
+ {
para978{[]int{100}},
ans978{1},
},
diff --git a/leetcode/0979.Distribute-Coins-in-Binary-Tree/979. Distribute Coins in Binary Tree_test.go b/leetcode/0979.Distribute-Coins-in-Binary-Tree/979. Distribute Coins in Binary Tree_test.go
index 201c8500..e38652ae 100644
--- a/leetcode/0979.Distribute-Coins-in-Binary-Tree/979. Distribute Coins in Binary Tree_test.go
+++ b/leetcode/0979.Distribute-Coins-in-Binary-Tree/979. Distribute Coins in Binary Tree_test.go
@@ -28,27 +28,27 @@ func Test_Problem979(t *testing.T) {
qs := []question979{
- question979{
+ {
para979{[]int{}},
ans979{0},
},
- question979{
+ {
para979{[]int{1}},
ans979{0},
},
- question979{
+ {
para979{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans979{41},
},
- question979{
+ {
para979{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
ans979{11},
},
- question979{
+ {
para979{[]int{1, 2, 3, 4, structures.NULL, 5}},
ans979{11},
},
diff --git a/leetcode/0980.Unique-Paths-III/980. Unique Paths III.go b/leetcode/0980.Unique-Paths-III/980. Unique Paths III.go
index f2f4809a..9a145eee 100644
--- a/leetcode/0980.Unique-Paths-III/980. Unique Paths III.go
+++ b/leetcode/0980.Unique-Paths-III/980. Unique Paths III.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func uniquePathsIII(grid [][]int) int {
@@ -53,7 +53,7 @@ func findUniquePathIII(board [][]int, visited [][]bool, path []int, empty, start
}
}
visited[startx][starty] = false
- empty++
+ //empty++ 这里虽然可以还原这个变量值,但是赋值没有意义,干脆不写了
path = path[:len(path)-2]
}
return
diff --git a/leetcode/0980.Unique-Paths-III/980. Unique Paths III_test.go b/leetcode/0980.Unique-Paths-III/980. Unique Paths III_test.go
index 1cdc6f88..571a2abc 100644
--- a/leetcode/0980.Unique-Paths-III/980. Unique Paths III_test.go
+++ b/leetcode/0980.Unique-Paths-III/980. Unique Paths III_test.go
@@ -26,28 +26,28 @@ func Test_Problem980(t *testing.T) {
qs := []question980{
- question980{
+ {
para980{[][]int{
- []int{1, 0, 0, 0},
- []int{0, 0, 0, 0},
- []int{0, 0, 2, -1},
+ {1, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 2, -1},
}},
ans980{2},
},
- question980{
+ {
para980{[][]int{
- []int{1, 0, 0, 0},
- []int{0, 0, 0, 0},
- []int{0, 0, 0, 2},
+ {1, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 2},
}},
ans980{4},
},
- question980{
+ {
para980{[][]int{
- []int{1, 0},
- []int{0, 2},
+ {1, 0},
+ {0, 2},
}},
ans980{0},
},
diff --git a/leetcode/0984.String-Without-AAA-or-BBB/984. String Without AAA or BBB_test.go b/leetcode/0984.String-Without-AAA-or-BBB/984. String Without AAA or BBB_test.go
index 2c6c78bd..343ac3c7 100644
--- a/leetcode/0984.String-Without-AAA-or-BBB/984. String Without AAA or BBB_test.go
+++ b/leetcode/0984.String-Without-AAA-or-BBB/984. String Without AAA or BBB_test.go
@@ -27,12 +27,12 @@ func Test_Problem984(t *testing.T) {
qs := []question984{
- question984{
+ {
para984{1, 2},
ans984{"abb"},
},
- question984{
+ {
para984{4, 1},
ans984{"aabaa"},
},
diff --git a/leetcode/0985.Sum-of-Even-Numbers-After-Queries/985. Sum of Even Numbers After Queries_test.go b/leetcode/0985.Sum-of-Even-Numbers-After-Queries/985. Sum of Even Numbers After Queries_test.go
index ae1ad153..26d2b71f 100644
--- a/leetcode/0985.Sum-of-Even-Numbers-After-Queries/985. Sum of Even Numbers After Queries_test.go
+++ b/leetcode/0985.Sum-of-Even-Numbers-After-Queries/985. Sum of Even Numbers After Queries_test.go
@@ -27,8 +27,8 @@ func Test_Problem985(t *testing.T) {
qs := []question985{
- question985{
- para985{[]int{1, 2, 3, 4}, [][]int{[]int{1, 0}, []int{-3, 1}, []int{-4, 0}, []int{2, 3}}},
+ {
+ para985{[]int{1, 2, 3, 4}, [][]int{{1, 0}, {-3, 1}, {-4, 0}, {2, 3}}},
ans985{[]int{8, 6, 2, 4}},
},
}
diff --git a/leetcode/0986.Interval-List-Intersections/986. Interval List Intersections_test.go b/leetcode/0986.Interval-List-Intersections/986. Interval List Intersections_test.go
index a39c4a9e..8db5161c 100644
--- a/leetcode/0986.Interval-List-Intersections/986. Interval List Intersections_test.go
+++ b/leetcode/0986.Interval-List-Intersections/986. Interval List Intersections_test.go
@@ -27,11 +27,11 @@ func Test_Problem986(t *testing.T) {
qs := []question986{
- question986{
- para986{[]Interval{Interval{Start: 0, End: 2}, Interval{Start: 5, End: 10}, Interval{Start: 13, End: 23}, Interval{Start: 24, End: 25}},
- []Interval{Interval{Start: 1, End: 5}, Interval{Start: 8, End: 12}, Interval{Start: 15, End: 24}, Interval{Start: 25, End: 26}}},
- ans986{[]Interval{Interval{Start: 1, End: 2}, Interval{Start: 5, End: 5}, Interval{Start: 8, End: 10},
- Interval{Start: 15, End: 23}, Interval{Start: 24, End: 24}, Interval{Start: 25, End: 25}}},
+ {
+ para986{[]Interval{{Start: 0, End: 2}, {Start: 5, End: 10}, {Start: 13, End: 23}, {Start: 24, End: 25}},
+ []Interval{{Start: 1, End: 5}, {Start: 8, End: 12}, {Start: 15, End: 24}, {Start: 25, End: 26}}},
+ ans986{[]Interval{{Start: 1, End: 2}, {Start: 5, End: 5}, {Start: 8, End: 10},
+ {Start: 15, End: 23}, {Start: 24, End: 24}, {Start: 25, End: 25}}},
},
}
diff --git a/leetcode/0990.Satisfiability-of-Equality-Equations/990. Satisfiability of Equality Equations_test.go b/leetcode/0990.Satisfiability-of-Equality-Equations/990. Satisfiability of Equality Equations_test.go
index 75b10c33..77c468db 100644
--- a/leetcode/0990.Satisfiability-of-Equality-Equations/990. Satisfiability of Equality Equations_test.go
+++ b/leetcode/0990.Satisfiability-of-Equality-Equations/990. Satisfiability of Equality Equations_test.go
@@ -26,27 +26,27 @@ func Test_Problem990(t *testing.T) {
qs := []question990{
- question990{
+ {
para990{[]string{"a==b", "b!=a"}},
ans990{false},
},
- question990{
+ {
para990{[]string{"b==a", "a==b"}},
ans990{true},
},
- question990{
+ {
para990{[]string{"a==b", "b==c", "a==c"}},
ans990{true},
},
- question990{
+ {
para990{[]string{"a==b", "b!=c", "c==a"}},
ans990{false},
},
- question990{
+ {
para990{[]string{"c==c", "b==d", "x!=z"}},
ans990{true},
},
diff --git a/leetcode/0992.Subarrays-with-K-Different-Integers/992. Subarrays with K Different Integers_test.go b/leetcode/0992.Subarrays-with-K-Different-Integers/992. Subarrays with K Different Integers_test.go
index 01eb4a71..6375cee2 100644
--- a/leetcode/0992.Subarrays-with-K-Different-Integers/992. Subarrays with K Different Integers_test.go
+++ b/leetcode/0992.Subarrays-with-K-Different-Integers/992. Subarrays with K Different Integers_test.go
@@ -27,37 +27,37 @@ func Test_Problem992(t *testing.T) {
qs := []question992{
- question992{
+ {
para992{[]int{1, 1, 1, 1, 1, 1, 1, 1}, 1},
ans992{36},
},
- question992{
+ {
para992{[]int{2, 1, 1, 1, 2}, 1},
ans992{8},
},
- question992{
+ {
para992{[]int{1, 2}, 1},
ans992{2},
},
- question992{
+ {
para992{[]int{1, 2, 1, 2, 3}, 2},
ans992{7},
},
- question992{
+ {
para992{[]int{1, 2, 1, 3, 4}, 3},
ans992{3},
},
- question992{
+ {
para992{[]int{1}, 5},
ans992{1},
},
- question992{
+ {
para992{[]int{}, 10},
ans992{0},
},
diff --git a/leetcode/0993.Cousins-in-Binary-Tree/993. Cousins in Binary Tree_test.go b/leetcode/0993.Cousins-in-Binary-Tree/993. Cousins in Binary Tree_test.go
index 4fb6a863..d0afbfc4 100644
--- a/leetcode/0993.Cousins-in-Binary-Tree/993. Cousins in Binary Tree_test.go
+++ b/leetcode/0993.Cousins-in-Binary-Tree/993. Cousins in Binary Tree_test.go
@@ -30,17 +30,17 @@ func Test_Problem993(t *testing.T) {
qs := []question993{
- question993{
+ {
para993{[]int{1, 2, 3, 4}, 4, 3},
ans993{false},
},
- question993{
+ {
para993{[]int{1, 2, 3, structures.NULL, 4, structures.NULL, 5}, 5, 4},
ans993{true},
},
- question993{
+ {
para993{[]int{1, 2, 3, structures.NULL, 4}, 2, 3},
ans993{false},
},
diff --git a/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips/995. Minimum Number of K Consecutive Bit Flips_test.go b/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips/995. Minimum Number of K Consecutive Bit Flips_test.go
index 9027b10c..41955d86 100644
--- a/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips/995. Minimum Number of K Consecutive Bit Flips_test.go
+++ b/leetcode/0995.Minimum-Number-of-K-Consecutive-Bit-Flips/995. Minimum Number of K Consecutive Bit Flips_test.go
@@ -27,17 +27,17 @@ func Test_Problem995(t *testing.T) {
qs := []question995{
- question995{
+ {
para995{[]int{0, 1, 0}, 1},
ans995{2},
},
- question995{
+ {
para995{[]int{1, 1, 0}, 2},
ans995{-1},
},
- question995{
+ {
para995{[]int{0, 0, 0, 1, 0, 1, 1, 0}, 3},
ans995{3},
},
diff --git a/leetcode/0996.Number-of-Squareful-Arrays/996. Number of Squareful Arrays_test.go b/leetcode/0996.Number-of-Squareful-Arrays/996. Number of Squareful Arrays_test.go
index 5e65695d..030e1fb9 100644
--- a/leetcode/0996.Number-of-Squareful-Arrays/996. Number of Squareful Arrays_test.go
+++ b/leetcode/0996.Number-of-Squareful-Arrays/996. Number of Squareful Arrays_test.go
@@ -26,22 +26,22 @@ func Test_Problem996(t *testing.T) {
qs := []question996{
- question996{
+ {
para996{[]int{1, 17, 8}},
ans996{2},
},
- question996{
+ {
para996{[]int{1}},
ans996{1},
},
- question996{
+ {
para996{[]int{2, 2, 2}},
ans996{1},
},
- question996{
+ {
para996{[]int{51768, 47861, 48143, 33221, 50893, 56758, 39946, 10312, 20276, 40616, 43633}},
ans996{1},
},
diff --git a/leetcode/0999.Available-Captures-for-Rook/999. Available Captures for Rook_test.go b/leetcode/0999.Available-Captures-for-Rook/999. Available Captures for Rook_test.go
index c1057702..9c6bb712 100644
--- a/leetcode/0999.Available-Captures-for-Rook/999. Available Captures for Rook_test.go
+++ b/leetcode/0999.Available-Captures-for-Rook/999. Available Captures for Rook_test.go
@@ -26,44 +26,44 @@ func Test_Problem999(t *testing.T) {
qs := []question999{
- question999{
+ {
para999{[][]byte{
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', 'p', 'p', 'p', 'p', 'p', '.', '.'},
- []byte{'.', 'p', 'p', 'B', 'p', 'p', '.', '.'},
- []byte{'.', 'p', 'B', 'R', 'B', 'p', '.', '.'},
- []byte{'.', 'p', 'p', 'B', 'p', 'p', '.', '.'},
- []byte{'.', 'p', 'p', 'p', 'p', 'p', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'},
+ {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'},
+ {'.', 'p', 'B', 'R', 'B', 'p', '.', '.'},
+ {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'},
+ {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
}},
ans999{0},
},
- question999{
+ {
para999{[][]byte{
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'p', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'R', '.', '.', '.', 'p'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'p', '.', '.', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', 'p', '.', '.', '.', '.'},
+ {'.', '.', '.', 'R', '.', '.', '.', 'p'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', 'p', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
}},
ans999{3},
},
- question999{
+ {
para999{[][]byte{
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'p', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'p', '.', '.', '.', '.'},
- []byte{'p', 'p', '.', 'R', '.', 'p', 'B', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'B', '.', '.', '.', '.'},
- []byte{'.', '.', '.', 'p', '.', '.', '.', '.'},
- []byte{'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', 'p', '.', '.', '.', '.'},
+ {'.', '.', '.', 'p', '.', '.', '.', '.'},
+ {'p', 'p', '.', 'R', '.', 'p', 'B', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
+ {'.', '.', '.', 'B', '.', '.', '.', '.'},
+ {'.', '.', '.', 'p', '.', '.', '.', '.'},
+ {'.', '.', '.', '.', '.', '.', '.', '.'},
}},
ans999{3},
},
diff --git a/leetcode/1002.Find-Common-Characters/1002. Find Common Characters_test.go b/leetcode/1002.Find-Common-Characters/1002. Find Common Characters_test.go
index 284ac09b..e03e8a6a 100644
--- a/leetcode/1002.Find-Common-Characters/1002. Find Common Characters_test.go
+++ b/leetcode/1002.Find-Common-Characters/1002. Find Common Characters_test.go
@@ -26,12 +26,12 @@ func Test_Problem1002(t *testing.T) {
qs := []question1002{
- question1002{
+ {
para1002{[]string{"bella", "label", "roller"}},
ans1002{[]string{"e", "l", "l"}},
},
- question1002{
+ {
para1002{[]string{"cool", "lock", "cook"}},
ans1002{[]string{"c", "o"}},
},
diff --git a/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions/1003. Check If Word Is Valid After Substitutions_test.go b/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions/1003. Check If Word Is Valid After Substitutions_test.go
index d0437941..a59ff8a2 100644
--- a/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions/1003. Check If Word Is Valid After Substitutions_test.go
+++ b/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions/1003. Check If Word Is Valid After Substitutions_test.go
@@ -26,22 +26,22 @@ func Test_Problem1003(t *testing.T) {
qs := []question1003{
- question1003{
+ {
para1003{"aabcbc"},
ans1003{true},
},
- question1003{
+ {
para1003{"abcabcababcc"},
ans1003{true},
},
- question1003{
+ {
para1003{"abccba"},
ans1003{false},
},
- question1003{
+ {
para1003{"cababc"},
ans1003{false},
},
diff --git a/leetcode/1004.Max-Consecutive-Ones-III/1004. Max Consecutive Ones III_test.go b/leetcode/1004.Max-Consecutive-Ones-III/1004. Max Consecutive Ones III_test.go
index 01e28d13..59f81473 100644
--- a/leetcode/1004.Max-Consecutive-Ones-III/1004. Max Consecutive Ones III_test.go
+++ b/leetcode/1004.Max-Consecutive-Ones-III/1004. Max Consecutive Ones III_test.go
@@ -27,17 +27,17 @@ func Test_Problem1004(t *testing.T) {
qs := []question1004{
- question1004{
+ {
para1004{[]int{1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0}, 2},
ans1004{6},
},
- question1004{
+ {
para1004{[]int{0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1}, 3},
ans1004{10},
},
- question1004{
+ {
para1004{[]int{0, 0, 0, 1}, 4},
ans1004{4},
},
diff --git a/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations/1005. Maximize Sum Of Array After K Negations_test.go b/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations/1005. Maximize Sum Of Array After K Negations_test.go
index 9e256ecd..1b16fdb2 100644
--- a/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations/1005. Maximize Sum Of Array After K Negations_test.go
+++ b/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations/1005. Maximize Sum Of Array After K Negations_test.go
@@ -27,36 +27,36 @@ func Test_Problem1005(t *testing.T) {
qs := []question1005{
- question1005{
+ {
para1005{[]int{4, 2, 3}, 1},
ans1005{5},
},
- question1005{
+ {
para1005{[]int{3, -1, 0, 2}, 3},
ans1005{6},
},
- question1005{
+ {
para1005{[]int{2, -3, -1, 5, -4}, 2},
ans1005{13},
},
- question1005{
+ {
para1005{[]int{-2, 9, 9, 8, 4}, 5},
ans1005{32},
},
- question1005{
+ {
para1005{[]int{5, -7, -8, -3, 9, 5, -5, -7}, 7},
ans1005{49},
},
- question1005{
+ {
para1005{[]int{5, 6, 9, -3, 3}, 2},
ans1005{20},
},
- question1005{
+ {
para1005{[]int{8, -7, -3, -9, 1, 9, -6, -9, 3}, 8},
ans1005{53},
},
diff --git a/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days/1011. Capacity To Ship Packages Within D Days_test.go b/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days/1011. Capacity To Ship Packages Within D Days_test.go
index 6251d2af..a7e359d6 100644
--- a/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days/1011. Capacity To Ship Packages Within D Days_test.go
+++ b/leetcode/1011.Capacity-To-Ship-Packages-Within-D-Days/1011. Capacity To Ship Packages Within D Days_test.go
@@ -27,22 +27,22 @@ func Test_Problem1011(t *testing.T) {
qs := []question1011{
- question1011{
+ {
para1011{[]int{7, 2, 5, 10, 8}, 2},
ans1011{18},
},
- question1011{
+ {
para1011{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 5},
ans1011{15},
},
- question1011{
+ {
para1011{[]int{3, 2, 2, 4, 1, 4}, 3},
ans1011{6},
},
- question1011{
+ {
para1011{[]int{1, 2, 3, 1, 1}, 4},
ans1011{3},
},
diff --git a/leetcode/1017.Convert-to-Base--2/1017. Convert to Base -2_test.go b/leetcode/1017.Convert-to-Base--2/1017. Convert to Base -2_test.go
index f016c590..0bcf767d 100644
--- a/leetcode/1017.Convert-to-Base--2/1017. Convert to Base -2_test.go
+++ b/leetcode/1017.Convert-to-Base--2/1017. Convert to Base -2_test.go
@@ -26,17 +26,17 @@ func Test_Problem1017(t *testing.T) {
qs := []question1017{
- question1017{
+ {
para1017{2},
ans1017{"110"},
},
- question1017{
+ {
para1017{3},
ans1017{"111"},
},
- question1017{
+ {
para1017{4},
ans1017{"110"},
},
diff --git a/leetcode/1019.Next-Greater-Node-In-Linked-List/1019. Next Greater Node In Linked List_test.go b/leetcode/1019.Next-Greater-Node-In-Linked-List/1019. Next Greater Node In Linked List_test.go
index c59589d8..d6b0f68b 100644
--- a/leetcode/1019.Next-Greater-Node-In-Linked-List/1019. Next Greater Node In Linked List_test.go
+++ b/leetcode/1019.Next-Greater-Node-In-Linked-List/1019. Next Greater Node In Linked List_test.go
@@ -28,22 +28,22 @@ func Test_Problem1019(t *testing.T) {
qs := []question1019{
- question1019{
+ {
para1019{[]int{2, 1, 5}},
ans1019{[]int{5, 5, 0}},
},
- question1019{
+ {
para1019{[]int{2, 7, 4, 3, 5}},
ans1019{[]int{7, 0, 5, 5, 0}},
},
- question1019{
+ {
para1019{[]int{1, 7, 5, 1, 9, 2, 5, 1}},
ans1019{[]int{7, 9, 9, 9, 0, 5, 0, 0}},
},
- question1019{
+ {
para1019{[]int{1, 7, 5, 1, 9, 2, 5, 6, 7, 8, 1}},
ans1019{[]int{7, 9, 9, 9, 0, 5, 6, 7, 8, 0, 0}},
},
diff --git a/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves.go b/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves.go
index ca0daa9a..1e69fd73 100644
--- a/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves.go
+++ b/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func numEnclaves(A [][]int) int {
diff --git a/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves_test.go b/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves_test.go
index 00ab5447..1aa7b5dc 100644
--- a/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves_test.go
+++ b/leetcode/1020.Number-of-Enclaves/1020. Number of Enclaves_test.go
@@ -26,55 +26,55 @@ func Test_Problem1020(t *testing.T) {
qs := []question1020{
- question1020{
+ {
para1020{[][]int{
- []int{1, 1, 1, 1, 0},
- []int{1, 1, 0, 1, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 0, 0, 0},
+ {1, 1, 1, 1, 0},
+ {1, 1, 0, 1, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 0, 0, 0},
}},
ans1020{0},
},
- question1020{
+ {
para1020{[][]int{
- []int{1, 1, 0, 0, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 1, 0, 0},
- []int{0, 0, 0, 1, 1},
+ {1, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 1, 0, 0},
+ {0, 0, 0, 1, 1},
}},
ans1020{1},
},
- question1020{
+ {
para1020{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 1, 0},
- []int{1, 0, 1, 0, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 1, 0},
+ {1, 0, 1, 0, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1, 0},
}},
ans1020{1},
},
- question1020{
+ {
para1020{[][]int{
- []int{0, 0, 1, 0, 0},
- []int{0, 1, 0, 1, 0},
- []int{0, 1, 1, 1, 0},
+ {0, 0, 1, 0, 0},
+ {0, 1, 0, 1, 0},
+ {0, 1, 1, 1, 0},
}},
ans1020{0},
},
- question1020{
+ {
para1020{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 1, 0, 1, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 1, 0, 1, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1},
}},
ans1020{8},
},
diff --git a/leetcode/1021.Remove-Outermost-Parentheses/1021. Remove Outermost Parentheses_test.go b/leetcode/1021.Remove-Outermost-Parentheses/1021. Remove Outermost Parentheses_test.go
index 828ffd32..5c72a5d0 100644
--- a/leetcode/1021.Remove-Outermost-Parentheses/1021. Remove Outermost Parentheses_test.go
+++ b/leetcode/1021.Remove-Outermost-Parentheses/1021. Remove Outermost Parentheses_test.go
@@ -25,17 +25,17 @@ type ans1021 struct {
func Test_Problem1021(t *testing.T) {
qs := []question1021{
- question1021{
+ {
para1021{"(()())(())"},
ans1021{"()()()"},
},
- question1021{
+ {
para1021{"(()())(())(()(()))"},
ans1021{"()()()()(())"},
},
- question1021{
+ {
para1021{"()()"},
ans1021{""},
},
diff --git a/leetcode/1025.Divisor-Game/1025. Divisor Game_test.go b/leetcode/1025.Divisor-Game/1025. Divisor Game_test.go
index ab48e304..3ea6237d 100644
--- a/leetcode/1025.Divisor-Game/1025. Divisor Game_test.go
+++ b/leetcode/1025.Divisor-Game/1025. Divisor Game_test.go
@@ -25,12 +25,12 @@ type ans1025 struct {
func Test_Problem1025(t *testing.T) {
qs := []question1025{
- question1025{
+ {
para1025{2},
ans1025{true},
},
- question1025{
+ {
para1025{3},
ans1025{false},
},
diff --git a/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor/1026. Maximum Difference Between Node and Ancestor_test.go b/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor/1026. Maximum Difference Between Node and Ancestor_test.go
index cdfbb730..5596f600 100644
--- a/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor/1026. Maximum Difference Between Node and Ancestor_test.go
+++ b/leetcode/1026.Maximum-Difference-Between-Node-and-Ancestor/1026. Maximum Difference Between Node and Ancestor_test.go
@@ -28,22 +28,22 @@ func Test_Problem1026(t *testing.T) {
qs := []question1026{
- question1026{
+ {
para1026{[]int{}},
ans1026{0},
},
- question1026{
+ {
para1026{[]int{8, 3, 10, 1, 6, structures.NULL, 14, structures.NULL, structures.NULL, 4, 7, 13}},
ans1026{7},
},
- question1026{
+ {
para1026{[]int{7, 6, 4, 3, 1}},
ans1026{6},
},
- question1026{
+ {
para1026{[]int{1, 3, 2, 8, 4, 9}},
ans1026{8},
},
diff --git a/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal/1028. Recover a Tree From Preorder Traversal_test.go b/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal/1028. Recover a Tree From Preorder Traversal_test.go
index 627dfedb..880213e4 100644
--- a/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal/1028. Recover a Tree From Preorder Traversal_test.go
+++ b/leetcode/1028.Recover-a-Tree-From-Preorder-Traversal/1028. Recover a Tree From Preorder Traversal_test.go
@@ -27,17 +27,17 @@ type ans1028 struct {
func Test_Problem1028(t *testing.T) {
qs := []question1028{
- question1028{
+ {
para1028{"1-2--3--4-5--6--7"},
ans1028{[]int{1, 2, 5, 3, 4, 6, 7}},
},
- question1028{
+ {
para1028{"1-2--3---4-5--6---7"},
ans1028{[]int{1, 2, 5, 3, structures.NULL, 6, structures.NULL, 4, structures.NULL, 7}},
},
- question1028{
+ {
para1028{"1-401--349---90--88"},
ans1028{[]int{1, 401, structures.NULL, 349, 88, 90}},
},
diff --git a/leetcode/1030.Matrix-Cells-in-Distance-Order/1030. Matrix Cells in Distance Order_test.go b/leetcode/1030.Matrix-Cells-in-Distance-Order/1030. Matrix Cells in Distance Order_test.go
index 91d8597f..5f6a07a6 100644
--- a/leetcode/1030.Matrix-Cells-in-Distance-Order/1030. Matrix Cells in Distance Order_test.go
+++ b/leetcode/1030.Matrix-Cells-in-Distance-Order/1030. Matrix Cells in Distance Order_test.go
@@ -29,19 +29,19 @@ func Test_Problem1030(t *testing.T) {
qs := []question1030{
- question1030{
+ {
para1030{1, 2, 0, 0},
- ans1030{[][]int{[]int{0, 0}, []int{0, 1}}},
+ ans1030{[][]int{{0, 0}, {0, 1}}},
},
- question1030{
+ {
para1030{2, 2, 0, 1},
- ans1030{[][]int{[]int{0, 1}, []int{0, 0}, []int{1, 1}, []int{1, 0}}},
+ ans1030{[][]int{{0, 1}, {0, 0}, {1, 1}, {1, 0}}},
},
- question1030{
+ {
para1030{2, 3, 1, 2},
- ans1030{[][]int{[]int{1, 2}, []int{0, 2}, []int{1, 1}, []int{0, 1}, []int{1, 0}, []int{0, 0}}},
+ ans1030{[][]int{{1, 2}, {0, 2}, {1, 1}, {0, 1}, {1, 0}, {0, 0}}},
},
}
diff --git a/leetcode/1037.Valid-Boomerang/1037. Valid Boomerang_test.go b/leetcode/1037.Valid-Boomerang/1037. Valid Boomerang_test.go
index db7b4c52..2d451a89 100644
--- a/leetcode/1037.Valid-Boomerang/1037. Valid Boomerang_test.go
+++ b/leetcode/1037.Valid-Boomerang/1037. Valid Boomerang_test.go
@@ -25,13 +25,13 @@ type ans1037 struct {
func Test_Problem1037(t *testing.T) {
qs := []question1037{
- question1037{
- para1037{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 2}}},
+ {
+ para1037{[][]int{{1, 2}, {2, 3}, {3, 2}}},
ans1037{true},
},
- question1037{
- para1037{[][]int{[]int{1, 1}, []int{2, 2}, []int{3, 3}}},
+ {
+ para1037{[][]int{{1, 1}, {2, 2}, {3, 3}}},
ans1037{false},
},
}
diff --git a/leetcode/1040.Moving-Stones-Until-Consecutive-II/1040. Moving Stones Until Consecutive II_test.go b/leetcode/1040.Moving-Stones-Until-Consecutive-II/1040. Moving Stones Until Consecutive II_test.go
index baf69382..0bed6999 100644
--- a/leetcode/1040.Moving-Stones-Until-Consecutive-II/1040. Moving Stones Until Consecutive II_test.go
+++ b/leetcode/1040.Moving-Stones-Until-Consecutive-II/1040. Moving Stones Until Consecutive II_test.go
@@ -25,22 +25,22 @@ type ans1040 struct {
func Test_Problem1040(t *testing.T) {
qs := []question1040{
- question1040{
+ {
para1040{[]int{7, 4, 9}},
ans1040{[]int{1, 2}},
},
- question1040{
+ {
para1040{[]int{6, 5, 4, 3, 10}},
ans1040{[]int{2, 3}},
},
- question1040{
+ {
para1040{[]int{100, 101, 104, 102, 103}},
ans1040{[]int{0, 0}},
},
- question1040{
+ {
para1040{[]int{1, 3, 5, 7, 10}},
ans1040{[]int{2, 4}},
},
diff --git a/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String/1047. Remove All Adjacent Duplicates In String_test.go b/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String/1047. Remove All Adjacent Duplicates In String_test.go
index e57c00cf..f11061a7 100644
--- a/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String/1047. Remove All Adjacent Duplicates In String_test.go
+++ b/leetcode/1047.Remove-All-Adjacent-Duplicates-In-String/1047. Remove All Adjacent Duplicates In String_test.go
@@ -26,7 +26,7 @@ func Test_Problem1047(t *testing.T) {
qs := []question1047{
- question1047{
+ {
para1047{"abbaca"},
ans1047{"ca"},
},
diff --git a/leetcode/1049.Last-Stone-Weight-II/1049. Last Stone Weight II_test.go b/leetcode/1049.Last-Stone-Weight-II/1049. Last Stone Weight II_test.go
index 0084f922..34b2847d 100644
--- a/leetcode/1049.Last-Stone-Weight-II/1049. Last Stone Weight II_test.go
+++ b/leetcode/1049.Last-Stone-Weight-II/1049. Last Stone Weight II_test.go
@@ -26,17 +26,17 @@ func Test_Problem1049(t *testing.T) {
qs := []question1049{
- question1049{
+ {
para1049{[]int{2, 7, 4, 1, 8, 1}},
ans1049{1},
},
- question1049{
+ {
para1049{[]int{21, 26, 31, 33, 40}},
ans1049{5},
},
- question1049{
+ {
para1049{[]int{1, 2}},
ans1049{1},
},
diff --git a/leetcode/1051.Height-Checker/1051. Height Checker_test.go b/leetcode/1051.Height-Checker/1051. Height Checker_test.go
index 43423ace..dc4c576c 100644
--- a/leetcode/1051.Height-Checker/1051. Height Checker_test.go
+++ b/leetcode/1051.Height-Checker/1051. Height Checker_test.go
@@ -26,22 +26,22 @@ func Test_Problem1051(t *testing.T) {
qs := []question1051{
- question1051{
+ {
para1051{[]int{1, 1, 4, 2, 1, 3}},
ans1051{3},
},
- question1051{
+ {
para1051{[]int{5, 1, 2, 3, 4}},
ans1051{5},
},
- question1051{
+ {
para1051{[]int{1, 2, 3, 4, 5}},
ans1051{0},
},
- question1051{
+ {
para1051{[]int{5, 4, 3, 2, 1}},
ans1051{4},
},
diff --git a/leetcode/1052.Grumpy-Bookstore-Owner/1052. Grumpy Bookstore Owner_test.go b/leetcode/1052.Grumpy-Bookstore-Owner/1052. Grumpy Bookstore Owner_test.go
index 327c5875..c0e84811 100644
--- a/leetcode/1052.Grumpy-Bookstore-Owner/1052. Grumpy Bookstore Owner_test.go
+++ b/leetcode/1052.Grumpy-Bookstore-Owner/1052. Grumpy Bookstore Owner_test.go
@@ -28,17 +28,17 @@ func Test_Problem1052(t *testing.T) {
qs := []question1052{
- question1052{
+ {
para1052{[]int{4, 10, 10}, []int{1, 1, 0}, 2},
ans1052{24},
},
- question1052{
+ {
para1052{[]int{1}, []int{0}, 1},
ans1052{1},
},
- question1052{
+ {
para1052{[]int{1, 0, 1, 2, 1, 1, 7, 5}, []int{0, 1, 0, 1, 0, 1, 0, 1}, 3},
ans1052{16},
},
diff --git a/leetcode/1054.Distant-Barcodes/1054. Distant Barcodes_test.go b/leetcode/1054.Distant-Barcodes/1054. Distant Barcodes_test.go
index 805075ce..118e2304 100644
--- a/leetcode/1054.Distant-Barcodes/1054. Distant Barcodes_test.go
+++ b/leetcode/1054.Distant-Barcodes/1054. Distant Barcodes_test.go
@@ -26,12 +26,12 @@ func Test_Problem1054(t *testing.T) {
qs := []question1054{
- question1054{
+ {
para1054{[]int{1, 1, 1, 2, 2, 2}},
ans1054{[]int{2, 1, 2, 1, 2, 1}},
},
- question1054{
+ {
para1054{[]int{1, 1, 1, 1, 2, 2, 3, 3}},
ans1054{[]int{1, 3, 1, 3, 2, 1, 2, 1}},
},
diff --git a/leetcode/1073.Adding-Two-Negabinary-Numbers/1073. Adding Two Negabinary Numbers_test.go b/leetcode/1073.Adding-Two-Negabinary-Numbers/1073. Adding Two Negabinary Numbers_test.go
index bf65c5fe..74386dd4 100644
--- a/leetcode/1073.Adding-Two-Negabinary-Numbers/1073. Adding Two Negabinary Numbers_test.go
+++ b/leetcode/1073.Adding-Two-Negabinary-Numbers/1073. Adding Two Negabinary Numbers_test.go
@@ -27,33 +27,33 @@ func Test_Problem1073(t *testing.T) {
qs := []question1073{
- question1073{
+ {
para1073{[]int{1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0},
[]int{1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1}},
ans1073{[]int{1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}},
},
- question1073{
+ {
para1073{[]int{0}, []int{1, 0, 0, 1}},
ans1073{[]int{1, 0, 0, 1}},
},
- question1073{
+ {
para1073{[]int{0}, []int{1, 1}},
ans1073{[]int{1, 1}},
},
- question1073{
+ {
para1073{[]int{1, 1, 1, 1, 1}, []int{1, 0, 1}},
ans1073{[]int{1, 0, 0, 0, 0}},
},
- question1073{
+ {
para1073{[]int{0}, []int{0}},
ans1073{[]int{0}},
},
- question1073{
+ {
para1073{[]int{0}, []int{1, 0}},
ans1073{[]int{1, 0}},
},
diff --git a/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target/1074. Number of Submatrices That Sum to Target_test.go b/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target/1074. Number of Submatrices That Sum to Target_test.go
index af070664..0b77d021 100644
--- a/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target/1074. Number of Submatrices That Sum to Target_test.go
+++ b/leetcode/1074.Number-of-Submatrices-That-Sum-to-Target/1074. Number of Submatrices That Sum to Target_test.go
@@ -27,13 +27,13 @@ func Test_Problem1074(t *testing.T) {
qs := []question1074{
- question1074{
- para1074{[][]int{[]int{0, 1, 0}, []int{1, 1, 1}, []int{0, 1, 0}}, 0},
+ {
+ para1074{[][]int{{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}, 0},
ans1074{4},
},
- question1074{
- para1074{[][]int{[]int{1, -1}, []int{-1, 1}}, 0},
+ {
+ para1074{[][]int{{1, -1}, {-1, 1}}, 0},
ans1074{5},
},
}
diff --git a/leetcode/1078.Occurrences-After-Bigram/1078. Occurrences After Bigram_test.go b/leetcode/1078.Occurrences-After-Bigram/1078. Occurrences After Bigram_test.go
index 020d3627..1c45d4a9 100644
--- a/leetcode/1078.Occurrences-After-Bigram/1078. Occurrences After Bigram_test.go
+++ b/leetcode/1078.Occurrences-After-Bigram/1078. Occurrences After Bigram_test.go
@@ -28,12 +28,12 @@ func Test_Problem1078(t *testing.T) {
qs := []question1078{
- question1078{
+ {
para1078{"alice is a good girl she is a good student", "a", "good"},
ans1078{[]string{"girl", "student"}},
},
- question1078{
+ {
para1078{"we will we will rock you", "we", "will"},
ans1078{[]string{"we", "rock"}},
},
diff --git a/leetcode/1079.Letter-Tile-Possibilities/1079. Letter Tile Possibilities_test.go b/leetcode/1079.Letter-Tile-Possibilities/1079. Letter Tile Possibilities_test.go
index f477a5b9..5b01d706 100644
--- a/leetcode/1079.Letter-Tile-Possibilities/1079. Letter Tile Possibilities_test.go
+++ b/leetcode/1079.Letter-Tile-Possibilities/1079. Letter Tile Possibilities_test.go
@@ -26,12 +26,12 @@ func Test_Problem1079(t *testing.T) {
qs := []question1079{
- question1079{
+ {
para1079{"AAB"},
ans1079{8},
},
- question1079{
+ {
para1079{"AAABBC"},
ans1079{188},
},
diff --git a/leetcode/1089.Duplicate-Zeros/1089. Duplicate Zeros_test.go b/leetcode/1089.Duplicate-Zeros/1089. Duplicate Zeros_test.go
index 35e37bd7..3916f0d0 100644
--- a/leetcode/1089.Duplicate-Zeros/1089. Duplicate Zeros_test.go
+++ b/leetcode/1089.Duplicate-Zeros/1089. Duplicate Zeros_test.go
@@ -25,17 +25,17 @@ func Test_Problem1089(t *testing.T) {
qs := []question1089{
- question1089{
+ {
para1089{[]int{1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0}},
ans1089{},
},
- question1089{
+ {
para1089{[]int{1, 0, 2, 3, 0, 4, 5, 0}},
ans1089{},
},
- question1089{
+ {
para1089{[]int{1, 2, 3}},
ans1089{},
},
diff --git a/leetcode/1093.Statistics-from-a-Large-Sample/1093. Statistics from a Large Sample_test.go b/leetcode/1093.Statistics-from-a-Large-Sample/1093. Statistics from a Large Sample_test.go
index c6c45af2..204ac353 100644
--- a/leetcode/1093.Statistics-from-a-Large-Sample/1093. Statistics from a Large Sample_test.go
+++ b/leetcode/1093.Statistics-from-a-Large-Sample/1093. Statistics from a Large Sample_test.go
@@ -26,12 +26,12 @@ func Test_Problem1093(t *testing.T) {
qs := []question1093{
- question1093{
+ {
para1093{[]int{0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
ans1093{[]float64{1.00000, 3.00000, 2.37500, 2.50000, 3.00000}},
},
- question1093{
+ {
para1093{[]int{0, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
ans1093{[]float64{1.00000, 4.00000, 2.18182, 2.00000, 1.00000}},
},
diff --git a/leetcode/1105.Filling-Bookcase-Shelves/1105. Filling Bookcase Shelves_test.go b/leetcode/1105.Filling-Bookcase-Shelves/1105. Filling Bookcase Shelves_test.go
index 5bd9d4c8..f3813ab8 100644
--- a/leetcode/1105.Filling-Bookcase-Shelves/1105. Filling Bookcase Shelves_test.go
+++ b/leetcode/1105.Filling-Bookcase-Shelves/1105. Filling Bookcase Shelves_test.go
@@ -27,8 +27,8 @@ func Test_Problem1105(t *testing.T) {
qs := []question1105{
- question1105{
- para1105{[][]int{[]int{1, 1}, []int{2, 3}, []int{2, 3}, []int{1, 1}, []int{1, 1}, []int{1, 1}, []int{1, 2}}, 4},
+ {
+ para1105{[][]int{{1, 1}, {2, 3}, {2, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 2}}, 4},
ans1105{6},
},
}
diff --git a/leetcode/1108.Defanging-an-IP-Address/1108. Defanging an IP Address_test.go b/leetcode/1108.Defanging-an-IP-Address/1108. Defanging an IP Address_test.go
index 03232f09..9580433f 100644
--- a/leetcode/1108.Defanging-an-IP-Address/1108. Defanging an IP Address_test.go
+++ b/leetcode/1108.Defanging-an-IP-Address/1108. Defanging an IP Address_test.go
@@ -26,12 +26,12 @@ func Test_Problem1108(t *testing.T) {
qs := []question1108{
- question1108{
+ {
para1108{"1.1.1.1"},
ans1108{"1[.]1[.]1[.]1"},
},
- question1108{
+ {
para1108{"255.100.50.0"},
ans1108{"255[.]100[.]50[.]0"},
},
diff --git a/leetcode/1110.Delete-Nodes-And-Return-Forest/1110. Delete Nodes And Return Forest_test.go b/leetcode/1110.Delete-Nodes-And-Return-Forest/1110. Delete Nodes And Return Forest_test.go
index db4bebb5..da8c70c4 100644
--- a/leetcode/1110.Delete-Nodes-And-Return-Forest/1110. Delete Nodes And Return Forest_test.go
+++ b/leetcode/1110.Delete-Nodes-And-Return-Forest/1110. Delete Nodes And Return Forest_test.go
@@ -29,9 +29,9 @@ func Test_Problem1110(t *testing.T) {
qs := []question1110{
- question1110{
+ {
para1110{[]int{1, 2, 3, 4, 5, 6, 7}, []int{3, 5}},
- ans1110{[][]int{[]int{1, 2, structures.NULL, 4}, []int{6}, []int{7}}},
+ ans1110{[][]int{{1, 2, structures.NULL, 4}, {6}, {7}}},
},
}
diff --git a/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/1111. Maximum Nesting Depth of Two Valid Parentheses Strings_test.go b/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/1111. Maximum Nesting Depth of Two Valid Parentheses Strings_test.go
index fffc33e8..332e8849 100644
--- a/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/1111. Maximum Nesting Depth of Two Valid Parentheses Strings_test.go
+++ b/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/1111. Maximum Nesting Depth of Two Valid Parentheses Strings_test.go
@@ -26,12 +26,12 @@ func Test_Problem1111(t *testing.T) {
qs := []question1111{
- question1111{
+ {
para1111{"(()())"},
ans1111{[]int{0, 1, 1, 1, 1, 0}},
},
- question1111{
+ {
para1111{"()(())()"},
ans1111{[]int{0, 0, 0, 1, 1, 0, 1, 1}},
},
diff --git a/leetcode/1122.Relative-Sort-Array/1122. Relative Sort Array_test.go b/leetcode/1122.Relative-Sort-Array/1122. Relative Sort Array_test.go
index 77684d59..8e53cf9a 100644
--- a/leetcode/1122.Relative-Sort-Array/1122. Relative Sort Array_test.go
+++ b/leetcode/1122.Relative-Sort-Array/1122. Relative Sort Array_test.go
@@ -27,7 +27,7 @@ func Test_Problem1122(t *testing.T) {
qs := []question1122{
- question1122{
+ {
para1122{[]int{2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19}, []int{2, 1, 4, 3, 9, 6}},
ans1122{[]int{2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19}},
},
diff --git a/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves/1123. Lowest Common Ancestor of Deepest Leaves_test.go b/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves/1123. Lowest Common Ancestor of Deepest Leaves_test.go
index 9f694a2a..5debb691 100644
--- a/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves/1123. Lowest Common Ancestor of Deepest Leaves_test.go
+++ b/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves/1123. Lowest Common Ancestor of Deepest Leaves_test.go
@@ -28,32 +28,32 @@ func Test_Problem1123(t *testing.T) {
qs := []question1123{
- question1123{
+ {
para1123{[]int{}},
ans1123{[]int{}},
},
- question1123{
+ {
para1123{[]int{1}},
ans1123{[]int{1}},
},
- question1123{
+ {
para1123{[]int{1, 2, 3, 4}},
ans1123{[]int{4}},
},
- question1123{
+ {
para1123{[]int{1, 2, 3}},
ans1123{[]int{1, 2, 3}},
},
- question1123{
+ {
para1123{[]int{1, 2, 3, 4, 5}},
ans1123{[]int{2, 4, 5}},
},
- question1123{
+ {
para1123{[]int{1, 2, structures.NULL, 3, 4, structures.NULL, 6, structures.NULL, 5}},
ans1123{[]int{2, 3, 4, structures.NULL, 6, structures.NULL, 5}},
},
diff --git a/leetcode/1128.Number-of-Equivalent-Domino-Pairs/1128. Number of Equivalent Domino Pairs_test.go b/leetcode/1128.Number-of-Equivalent-Domino-Pairs/1128. Number of Equivalent Domino Pairs_test.go
index 484f79eb..efb82053 100644
--- a/leetcode/1128.Number-of-Equivalent-Domino-Pairs/1128. Number of Equivalent Domino Pairs_test.go
+++ b/leetcode/1128.Number-of-Equivalent-Domino-Pairs/1128. Number of Equivalent Domino Pairs_test.go
@@ -26,8 +26,8 @@ func Test_Problem1128(t *testing.T) {
qs := []question1128{
- question1128{
- para1128{[][]int{[]int{1, 2}, []int{2, 1}, []int{3, 4}, []int{5, 6}}},
+ {
+ para1128{[][]int{{1, 2}, {2, 1}, {3, 4}, {5, 6}}},
ans1128{1},
},
}
diff --git a/leetcode/1137.N-th-Tribonacci-Number/1137. N-th Tribonacci Number_test.go b/leetcode/1137.N-th-Tribonacci-Number/1137. N-th Tribonacci Number_test.go
index 3b0bce88..2546339e 100644
--- a/leetcode/1137.N-th-Tribonacci-Number/1137. N-th Tribonacci Number_test.go
+++ b/leetcode/1137.N-th-Tribonacci-Number/1137. N-th Tribonacci Number_test.go
@@ -26,27 +26,27 @@ func Test_Problem1137(t *testing.T) {
qs := []question1137{
- question1137{
+ {
para1137{1},
ans1137{1},
},
- question1137{
+ {
para1137{2},
ans1137{1},
},
- question1137{
+ {
para1137{3},
ans1137{2},
},
- question1137{
+ {
para1137{4},
ans1137{4},
},
- question1137{
+ {
para1137{25},
ans1137{1389537},
},
diff --git a/leetcode/1145.Binary-Tree-Coloring-Game/1145. Binary Tree Coloring Game_test.go b/leetcode/1145.Binary-Tree-Coloring-Game/1145. Binary Tree Coloring Game_test.go
index 964c8164..79b3f574 100644
--- a/leetcode/1145.Binary-Tree-Coloring-Game/1145. Binary Tree Coloring Game_test.go
+++ b/leetcode/1145.Binary-Tree-Coloring-Game/1145. Binary Tree Coloring Game_test.go
@@ -30,7 +30,7 @@ func Test_Problem1145(t *testing.T) {
qs := []question1145{
- question1145{
+ {
para1145{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11, 3},
ans1145{true},
},
diff --git a/leetcode/1154.Day-of-the-Year/1154. Day of the Year_test.go b/leetcode/1154.Day-of-the-Year/1154. Day of the Year_test.go
index d9d83b60..cdd07c2c 100644
--- a/leetcode/1154.Day-of-the-Year/1154. Day of the Year_test.go
+++ b/leetcode/1154.Day-of-the-Year/1154. Day of the Year_test.go
@@ -26,22 +26,22 @@ func Test_Problem1154(t *testing.T) {
qs := []question1154{
- question1154{
+ {
para1154{"2019-01-09"},
ans1154{9},
},
- question1154{
+ {
para1154{"2019-02-10"},
ans1154{41},
},
- question1154{
+ {
para1154{"2003-03-01"},
ans1154{60},
},
- question1154{
+ {
para1154{"2004-03-01"},
ans1154{61},
},
diff --git a/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters/1160. Find Words That Can Be Formed by Characters_test.go b/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters/1160. Find Words That Can Be Formed by Characters_test.go
index 9549fcbe..7820fc52 100644
--- a/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters/1160. Find Words That Can Be Formed by Characters_test.go
+++ b/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters/1160. Find Words That Can Be Formed by Characters_test.go
@@ -27,12 +27,12 @@ func Test_Problem1160(t *testing.T) {
qs := []question1160{
- question1160{
+ {
para1160{[]string{"cat", "bt", "hat", "tree"}, "atach"},
ans1160{6},
},
- question1160{
+ {
para1160{[]string{"hello", "world", "leetcode"}, "welldonehoneyr"},
ans1160{10},
},
diff --git a/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character/1170. Compare Strings by Frequency of the Smallest Character_test.go b/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character/1170. Compare Strings by Frequency of the Smallest Character_test.go
index 03a70ee5..ea6e7105 100644
--- a/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character/1170. Compare Strings by Frequency of the Smallest Character_test.go
+++ b/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character/1170. Compare Strings by Frequency of the Smallest Character_test.go
@@ -27,12 +27,12 @@ func Test_Problem1170(t *testing.T) {
qs := []question1170{
- question1170{
+ {
para1170{[]string{"cbd"}, []string{"zaaaz"}},
ans1170{[]int{1}},
},
- question1170{
+ {
para1170{[]string{"bbb", "cc"}, []string{"a", "aa", "aaa", "aaaa"}},
ans1170{[]int{1, 2}},
},
diff --git a/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List/1171. Remove Zero Sum Consecutive Nodes from Linked List_test.go b/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List/1171. Remove Zero Sum Consecutive Nodes from Linked List_test.go
index d91b59d8..f6276900 100644
--- a/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List/1171. Remove Zero Sum Consecutive Nodes from Linked List_test.go
+++ b/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List/1171. Remove Zero Sum Consecutive Nodes from Linked List_test.go
@@ -28,22 +28,22 @@ func Test_Problem1171(t *testing.T) {
qs := []question1171{
- question1171{
+ {
para1171{[]int{1, 2, -3, 3, 1}},
ans1171{[]int{3, 1}},
},
- question1171{
+ {
para1171{[]int{1, 2, 3, -3, 4}},
ans1171{[]int{1, 2, 4}},
},
- question1171{
+ {
para1171{[]int{1, 2, 3, -3, -2}},
ans1171{[]int{1}},
},
- question1171{
+ {
para1171{[]int{1, -1}},
ans1171{[]int{}},
},
diff --git a/leetcode/1175.Prime-Arrangements/1175. Prime Arrangements_test.go b/leetcode/1175.Prime-Arrangements/1175. Prime Arrangements_test.go
index 37627f62..0bd25db6 100644
--- a/leetcode/1175.Prime-Arrangements/1175. Prime Arrangements_test.go
+++ b/leetcode/1175.Prime-Arrangements/1175. Prime Arrangements_test.go
@@ -26,17 +26,17 @@ func Test_Problem1175(t *testing.T) {
qs := []question1175{
- question1175{
+ {
para1175{5},
ans1175{12},
},
- question1175{
+ {
para1175{99},
ans1175{75763854},
},
- question1175{
+ {
para1175{100},
ans1175{682289015},
},
diff --git a/leetcode/1184.Distance-Between-Bus-Stops/1184. Distance Between Bus Stops_test.go b/leetcode/1184.Distance-Between-Bus-Stops/1184. Distance Between Bus Stops_test.go
index 9707cd7b..95391f94 100644
--- a/leetcode/1184.Distance-Between-Bus-Stops/1184. Distance Between Bus Stops_test.go
+++ b/leetcode/1184.Distance-Between-Bus-Stops/1184. Distance Between Bus Stops_test.go
@@ -28,17 +28,17 @@ func Test_Problem1184(t *testing.T) {
qs := []question1184{
- question1184{
+ {
para1184{[]int{1, 2, 3, 4}, 0, 1},
ans1184{1},
},
- question1184{
+ {
para1184{[]int{1, 2, 3, 4}, 0, 2},
ans1184{3},
},
- question1184{
+ {
para1184{[]int{1, 2, 3, 4}, 0, 3},
ans1184{4},
},
diff --git a/leetcode/1185.Day-of-the-Week/1185. Day of the Week_test.go b/leetcode/1185.Day-of-the-Week/1185. Day of the Week_test.go
index 53c67bd6..70728c1e 100644
--- a/leetcode/1185.Day-of-the-Week/1185. Day of the Week_test.go
+++ b/leetcode/1185.Day-of-the-Week/1185. Day of the Week_test.go
@@ -28,17 +28,17 @@ func Test_Problem1185(t *testing.T) {
qs := []question1185{
- question1185{
+ {
para1185{31, 8, 2019},
ans1185{"Saturday"},
},
- question1185{
+ {
para1185{18, 7, 1999},
ans1185{"Sunday"},
},
- question1185{
+ {
para1185{15, 8, 1993},
ans1185{"Sunday"},
},
diff --git a/leetcode/1189.Maximum-Number-of-Balloons/1189. Maximum Number of Balloons_test.go b/leetcode/1189.Maximum-Number-of-Balloons/1189. Maximum Number of Balloons_test.go
index 959338fb..1dcb110e 100644
--- a/leetcode/1189.Maximum-Number-of-Balloons/1189. Maximum Number of Balloons_test.go
+++ b/leetcode/1189.Maximum-Number-of-Balloons/1189. Maximum Number of Balloons_test.go
@@ -26,17 +26,17 @@ func Test_Problem1189(t *testing.T) {
qs := []question1189{
- question1189{
+ {
para1189{"nlaebolko"},
ans1189{1},
},
- question1189{
+ {
para1189{"loonbalxballpoon"},
ans1189{2},
},
- question1189{
+ {
para1189{"leetcode"},
ans1189{0},
},
diff --git a/leetcode/1200.Minimum-Absolute-Difference/1200. Minimum Absolute Difference_test.go b/leetcode/1200.Minimum-Absolute-Difference/1200. Minimum Absolute Difference_test.go
index 140377cd..6b24d92b 100644
--- a/leetcode/1200.Minimum-Absolute-Difference/1200. Minimum Absolute Difference_test.go
+++ b/leetcode/1200.Minimum-Absolute-Difference/1200. Minimum Absolute Difference_test.go
@@ -26,19 +26,19 @@ func Test_Problem1200(t *testing.T) {
qs := []question1200{
- question1200{
+ {
para1200{[]int{4, 2, 1, 3}},
- ans1200{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 4}}},
+ ans1200{[][]int{{1, 2}, {2, 3}, {3, 4}}},
},
- question1200{
+ {
para1200{[]int{1, 3, 6, 10, 15}},
- ans1200{[][]int{[]int{1, 3}}},
+ ans1200{[][]int{{1, 3}}},
},
- question1200{
+ {
para1200{[]int{3, 8, -10, 23, 19, -4, -14, 27}},
- ans1200{[][]int{[]int{-14, -10}, []int{19, 23}, []int{23, 27}}},
+ ans1200{[][]int{{-14, -10}, {19, 23}, {23, 27}}},
},
}
diff --git a/leetcode/1201.Ugly-Number-III/1201. Ugly Number III_test.go b/leetcode/1201.Ugly-Number-III/1201. Ugly Number III_test.go
index 45ec2229..5d5b501a 100644
--- a/leetcode/1201.Ugly-Number-III/1201. Ugly Number III_test.go
+++ b/leetcode/1201.Ugly-Number-III/1201. Ugly Number III_test.go
@@ -29,22 +29,22 @@ func Test_Problem1201(t *testing.T) {
qs := []question1201{
- question1201{
+ {
para1201{3, 2, 3, 5},
ans1201{4},
},
- question1201{
+ {
para1201{4, 2, 3, 4},
ans1201{6},
},
- question1201{
+ {
para1201{5, 2, 11, 13},
ans1201{10},
},
- question1201{
+ {
para1201{1000000000, 2, 217983653, 336916467},
ans1201{1999999984},
},
diff --git a/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps.go b/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps.go
index fdd79625..60ce722b 100644
--- a/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps.go
+++ b/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps.go
@@ -25,7 +25,7 @@ func smallestStringWithSwaps(s string, pairs [][]int) string {
r := uf.Find(i)
bytes := sMap[r]
res[i] = bytes[0]
- sMap[r] = bytes[1:len(bytes)]
+ sMap[r] = bytes[1:]
}
return string(res)
}
diff --git a/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps_test.go b/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps_test.go
index 71030e52..8e123e77 100644
--- a/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps_test.go
+++ b/leetcode/1202.Smallest-String-With-Swaps/1202. Smallest String With Swaps_test.go
@@ -27,18 +27,18 @@ func Test_Problem1202(t *testing.T) {
qs := []question1202{
- question1202{
- para1202{"dcab", [][]int{[]int{0, 3}, []int{1, 2}}},
+ {
+ para1202{"dcab", [][]int{{0, 3}, {1, 2}}},
ans1202{"bacd"},
},
- question1202{
- para1202{"dcab", [][]int{[]int{0, 3}, []int{1, 2}, []int{0, 2}}},
+ {
+ para1202{"dcab", [][]int{{0, 3}, {1, 2}, {0, 2}}},
ans1202{"abcd"},
},
- question1202{
- para1202{"cba", [][]int{[]int{0, 1}, []int{1, 2}}},
+ {
+ para1202{"cba", [][]int{{0, 1}, {1, 2}}},
ans1202{"abc"},
},
}
diff --git a/leetcode/1207.Unique-Number-of-Occurrences/1207. Unique Number of Occurrences_test.go b/leetcode/1207.Unique-Number-of-Occurrences/1207. Unique Number of Occurrences_test.go
index 58d513b0..9f4728dc 100644
--- a/leetcode/1207.Unique-Number-of-Occurrences/1207. Unique Number of Occurrences_test.go
+++ b/leetcode/1207.Unique-Number-of-Occurrences/1207. Unique Number of Occurrences_test.go
@@ -26,17 +26,17 @@ func Test_Problem1207(t *testing.T) {
qs := []question1207{
- question1207{
+ {
para1207{[]int{1, 2, 2, 1, 1, 3}},
ans1207{true},
},
- question1207{
+ {
para1207{[]int{1, 2}},
ans1207{false},
},
- question1207{
+ {
para1207{[]int{-3, 0, 1, -3, 1, 1, 1, -3, 10, 0}},
ans1207{true},
},
diff --git a/leetcode/1208.Get-Equal-Substrings-Within-Budget/1208. Get Equal Substrings Within Budget_test.go b/leetcode/1208.Get-Equal-Substrings-Within-Budget/1208. Get Equal Substrings Within Budget_test.go
index 385f9e9b..86f50180 100644
--- a/leetcode/1208.Get-Equal-Substrings-Within-Budget/1208. Get Equal Substrings Within Budget_test.go
+++ b/leetcode/1208.Get-Equal-Substrings-Within-Budget/1208. Get Equal Substrings Within Budget_test.go
@@ -28,27 +28,27 @@ func Test_Problem1208(t *testing.T) {
qs := []question1208{
- question1208{
+ {
para1208{"abcd", "bcdf", 3},
ans1208{3},
},
- question1208{
+ {
para1208{"abcd", "cdef", 3},
ans1208{1},
},
- question1208{
+ {
para1208{"abcd", "acde", 0},
ans1208{1},
},
- question1208{
+ {
para1208{"thjdoffka", "qhrnlntls", 11},
ans1208{3},
},
- question1208{
+ {
para1208{"krrgw", "zjxss", 19},
ans1208{2},
},
diff --git a/leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go b/leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go
index ae0b1163..fcc7beca 100644
--- a/leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go
+++ b/leetcode/1217.Play-with-Chips/1217. Play with Chips_test.go
@@ -26,12 +26,12 @@ func Test_Problem1217(t *testing.T) {
qs := []question1217{
- question1217{
+ {
para1217{[]int{1, 2, 3}},
ans1217{1},
},
- question1217{
+ {
para1217{[]int{2, 2, 2, 3, 3}},
ans1217{2},
},
diff --git a/leetcode/1221.Split-a-String-in-Balanced-Strings/1221. Split a String in Balanced Strings_test.go b/leetcode/1221.Split-a-String-in-Balanced-Strings/1221. Split a String in Balanced Strings_test.go
index ad546137..f5691c5e 100644
--- a/leetcode/1221.Split-a-String-in-Balanced-Strings/1221. Split a String in Balanced Strings_test.go
+++ b/leetcode/1221.Split-a-String-in-Balanced-Strings/1221. Split a String in Balanced Strings_test.go
@@ -26,17 +26,17 @@ func Test_Problem1221(t *testing.T) {
qs := []question1221{
- question1221{
+ {
para1221{"RLRRLLRLRL"},
ans1221{4},
},
- question1221{
+ {
para1221{"RLLLLRRRLR"},
ans1221{3},
},
- question1221{
+ {
para1221{"LLLLRRRR"},
ans1221{1},
},
diff --git a/leetcode/1232.Check-If-It-Is-a-Straight-Line/1232. Check If It Is a Straight Line_test.go b/leetcode/1232.Check-If-It-Is-a-Straight-Line/1232. Check If It Is a Straight Line_test.go
index 08423596..63710630 100644
--- a/leetcode/1232.Check-If-It-Is-a-Straight-Line/1232. Check If It Is a Straight Line_test.go
+++ b/leetcode/1232.Check-If-It-Is-a-Straight-Line/1232. Check If It Is a Straight Line_test.go
@@ -26,13 +26,13 @@ func Test_Problem1232(t *testing.T) {
qs := []question1232{
- question1232{
- para1232{[][]int{[]int{1, 2}, []int{2, 3}, []int{3, 4}, []int{4, 5}, []int{5, 6}, []int{6, 7}}},
+ {
+ para1232{[][]int{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}},
ans1232{true},
},
- question1232{
- para1232{[][]int{[]int{1, 1}, []int{2, 2}, []int{3, 4}, []int{4, 5}, []int{5, 6}, []int{7, 7}}},
+ {
+ para1232{[][]int{{1, 1}, {2, 2}, {3, 4}, {4, 5}, {5, 6}, {7, 7}}},
ans1232{false},
},
}
diff --git a/leetcode/1234.Replace-the-Substring-for-Balanced-String/1234. Replace the Substring for Balanced String_test.go b/leetcode/1234.Replace-the-Substring-for-Balanced-String/1234. Replace the Substring for Balanced String_test.go
index 0a592723..854dc2bc 100644
--- a/leetcode/1234.Replace-the-Substring-for-Balanced-String/1234. Replace the Substring for Balanced String_test.go
+++ b/leetcode/1234.Replace-the-Substring-for-Balanced-String/1234. Replace the Substring for Balanced String_test.go
@@ -26,27 +26,27 @@ func Test_Problem1234(t *testing.T) {
qs := []question1234{
- question1234{
+ {
para1234{"QWER"},
ans1234{0},
},
- question1234{
+ {
para1234{"QQWE"},
ans1234{1},
},
- question1234{
+ {
para1234{"QQQW"},
ans1234{2},
},
- question1234{
+ {
para1234{"QQQQ"},
ans1234{3},
},
- question1234{
+ {
para1234{"WQWRQQQW"},
ans1234{3},
},
diff --git a/leetcode/1235.Maximum-Profit-in-Job-Scheduling/1235. Maximum Profit in Job Scheduling_test.go b/leetcode/1235.Maximum-Profit-in-Job-Scheduling/1235. Maximum Profit in Job Scheduling_test.go
index 65b49a7d..77501bf4 100644
--- a/leetcode/1235.Maximum-Profit-in-Job-Scheduling/1235. Maximum Profit in Job Scheduling_test.go
+++ b/leetcode/1235.Maximum-Profit-in-Job-Scheduling/1235. Maximum Profit in Job Scheduling_test.go
@@ -28,17 +28,17 @@ func Test_Problem1235(t *testing.T) {
qs := []question1235{
- question1235{
+ {
para1235{[]int{1, 2, 3, 3}, []int{3, 4, 5, 6}, []int{50, 10, 40, 70}},
ans1235{120},
},
- question1235{
+ {
para1235{[]int{1, 2, 3, 4, 6}, []int{3, 5, 10, 6, 9}, []int{20, 20, 100, 70, 60}},
ans1235{150},
},
- question1235{
+ {
para1235{[]int{1, 1, 1}, []int{2, 3, 4}, []int{5, 6, 4}},
ans1235{6},
},
diff --git a/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix/1252. Cells with Odd Values in a Matrix_test.go b/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix/1252. Cells with Odd Values in a Matrix_test.go
index 747aa7c8..df409893 100644
--- a/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix/1252. Cells with Odd Values in a Matrix_test.go
+++ b/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix/1252. Cells with Odd Values in a Matrix_test.go
@@ -28,13 +28,13 @@ func Test_Problem1252(t *testing.T) {
qs := []question1252{
- question1252{
- para1252{2, 3, [][]int{[]int{0, 1}, []int{1, 1}}},
+ {
+ para1252{2, 3, [][]int{{0, 1}, {1, 1}}},
ans1252{6},
},
- question1252{
- para1252{2, 2, [][]int{[]int{1, 1}, []int{0, 0}}},
+ {
+ para1252{2, 2, [][]int{{1, 1}, {0, 0}}},
ans1252{0},
},
}
diff --git a/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands.go b/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands.go
index 18d6afe8..c7773dd6 100644
--- a/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands.go
+++ b/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands.go
@@ -1,10 +1,10 @@
package leetcode
var dir = [][]int{
- []int{-1, 0},
- []int{0, 1},
- []int{1, 0},
- []int{0, -1},
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
}
func closedIsland(grid [][]int) int {
diff --git a/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands_test.go b/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands_test.go
index 5bce0d15..a91cfeab 100644
--- a/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands_test.go
+++ b/leetcode/1254.Number-of-Closed-Islands/1254. Number of Closed Islands_test.go
@@ -26,55 +26,55 @@ func Test_Problem1254(t *testing.T) {
qs := []question1254{
- question1254{
+ {
para1254{[][]int{
- []int{1, 1, 1, 1, 0},
- []int{1, 1, 0, 1, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 0, 0, 0},
+ {1, 1, 1, 1, 0},
+ {1, 1, 0, 1, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 0, 0, 0},
}},
ans1254{0},
},
- question1254{
+ {
para1254{[][]int{
- []int{1, 1, 0, 0, 0},
- []int{1, 1, 0, 0, 0},
- []int{0, 0, 1, 0, 0},
- []int{0, 0, 0, 1, 1},
+ {1, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 1, 0, 0},
+ {0, 0, 0, 1, 1},
}},
ans1254{0},
},
- question1254{
+ {
para1254{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 1, 0},
- []int{1, 0, 1, 0, 1, 1, 1, 0},
- []int{1, 0, 0, 0, 0, 1, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 1, 1, 1, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 1, 0},
+ {1, 0, 1, 0, 1, 1, 1, 0},
+ {1, 0, 0, 0, 0, 1, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1, 0},
}},
ans1254{2},
},
- question1254{
+ {
para1254{[][]int{
- []int{0, 0, 1, 0, 0},
- []int{0, 1, 0, 1, 0},
- []int{0, 1, 1, 1, 0},
+ {0, 0, 1, 0, 0},
+ {0, 1, 0, 1, 0},
+ {0, 1, 1, 1, 0},
}},
ans1254{1},
},
- question1254{
+ {
para1254{[][]int{
- []int{1, 1, 1, 1, 1, 1, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 1, 0, 1, 0, 1},
- []int{1, 0, 1, 1, 1, 0, 1},
- []int{1, 0, 0, 0, 0, 0, 1},
- []int{1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 1, 0, 1, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 0, 0, 0, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1},
}},
ans1254{2},
},
diff --git a/leetcode/1260.Shift-2D-Grid/1260. Shift 2D Grid_test.go b/leetcode/1260.Shift-2D-Grid/1260. Shift 2D Grid_test.go
index a26d7d84..8b4167e1 100644
--- a/leetcode/1260.Shift-2D-Grid/1260. Shift 2D Grid_test.go
+++ b/leetcode/1260.Shift-2D-Grid/1260. Shift 2D Grid_test.go
@@ -27,24 +27,24 @@ func Test_Problem1260(t *testing.T) {
qs := []question1260{
- question1260{
- para1260{[][]int{[]int{3, 7, 8}, []int{9, 11, 13}, []int{15, 16, 17}}, 2},
- ans1260{[][]int{[]int{16, 17, 3}, []int{7, 8, 9}, []int{11, 13, 15}}},
+ {
+ para1260{[][]int{{3, 7, 8}, {9, 11, 13}, {15, 16, 17}}, 2},
+ ans1260{[][]int{{16, 17, 3}, {7, 8, 9}, {11, 13, 15}}},
},
- question1260{
- para1260{[][]int{[]int{1, 10, 4, 2}, []int{9, 3, 8, 7}, []int{15, 16, 17, 12}}, 10},
- ans1260{[][]int{[]int{4, 2, 9, 3}, []int{8, 7, 15, 16}, []int{17, 12, 1, 10}}},
+ {
+ para1260{[][]int{{1, 10, 4, 2}, {9, 3, 8, 7}, {15, 16, 17, 12}}, 10},
+ ans1260{[][]int{{4, 2, 9, 3}, {8, 7, 15, 16}, {17, 12, 1, 10}}},
},
- question1260{
- para1260{[][]int{[]int{3, 8, 1, 9}, []int{19, 7, 2, 5}, []int{4, 6, 11, 10}, []int{12, 0, 21, 13}}, 4},
- ans1260{[][]int{[]int{12, 0, 21, 13}, []int{3, 8, 1, 9}, []int{19, 7, 2, 5}, []int{4, 6, 11, 10}}},
+ {
+ para1260{[][]int{{3, 8, 1, 9}, {19, 7, 2, 5}, {4, 6, 11, 10}, {12, 0, 21, 13}}, 4},
+ ans1260{[][]int{{12, 0, 21, 13}, {3, 8, 1, 9}, {19, 7, 2, 5}, {4, 6, 11, 10}}},
},
- question1260{
- para1260{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}, 9},
- ans1260{[][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}},
+ {
+ para1260{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, 9},
+ ans1260{[][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}},
},
// 如需多个测试,可以复制上方元素。
}
diff --git a/leetcode/1266.Minimum-Time-Visiting-All-Points/1266. Minimum Time Visiting All Points_test.go b/leetcode/1266.Minimum-Time-Visiting-All-Points/1266. Minimum Time Visiting All Points_test.go
index 155a7dfb..95461646 100644
--- a/leetcode/1266.Minimum-Time-Visiting-All-Points/1266. Minimum Time Visiting All Points_test.go
+++ b/leetcode/1266.Minimum-Time-Visiting-All-Points/1266. Minimum Time Visiting All Points_test.go
@@ -26,13 +26,13 @@ func Test_Problem1266(t *testing.T) {
qs := []question1266{
- question1266{
- para1266{[][]int{[]int{1, 1}, []int{3, 4}, []int{-1, 0}}},
+ {
+ para1266{[][]int{{1, 1}, {3, 4}, {-1, 0}}},
ans1266{7},
},
- question1266{
- para1266{[][]int{[]int{3, 2}, []int{-2, 2}}},
+ {
+ para1266{[][]int{{3, 2}, {-2, 2}}},
ans1266{5},
},
}
diff --git a/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game/1275. Find Winner on a Tic Tac Toe Game_test.go b/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game/1275. Find Winner on a Tic Tac Toe Game_test.go
index 360a9258..8502ddef 100644
--- a/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game/1275. Find Winner on a Tic Tac Toe Game_test.go
+++ b/leetcode/1275.Find-Winner-on-a-Tic-Tac-Toe-Game/1275. Find Winner on a Tic Tac Toe Game_test.go
@@ -26,23 +26,23 @@ func Test_Problem1275(t *testing.T) {
qs := []question1275{
- question1275{
- para1275{[][]int{[]int{0, 0}, []int{2, 0}, []int{1, 1}, []int{2, 1}, []int{2, 2}}},
+ {
+ para1275{[][]int{{0, 0}, {2, 0}, {1, 1}, {2, 1}, {2, 2}}},
ans1275{"A"},
},
- question1275{
- para1275{[][]int{[]int{0, 0}, []int{1, 1}, []int{0, 1}, []int{0, 2}, []int{1, 0}, []int{2, 0}}},
+ {
+ para1275{[][]int{{0, 0}, {1, 1}, {0, 1}, {0, 2}, {1, 0}, {2, 0}}},
ans1275{"B"},
},
- question1275{
- para1275{[][]int{[]int{0, 0}, []int{1, 1}, []int{2, 0}, []int{1, 0}, []int{1, 2}, []int{2, 1}, []int{0, 1}, []int{0, 2}, []int{2, 2}}},
+ {
+ para1275{[][]int{{0, 0}, {1, 1}, {2, 0}, {1, 0}, {1, 2}, {2, 1}, {0, 1}, {0, 2}, {2, 2}}},
ans1275{"Draw"},
},
- question1275{
- para1275{[][]int{[]int{0, 0}, []int{1, 1}}},
+ {
+ para1275{[][]int{{0, 0}, {1, 1}}},
ans1275{"Pending"},
},
}
diff --git a/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer/1281. Subtract the Product and Sum of Digits of an Integer_test.go b/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer/1281. Subtract the Product and Sum of Digits of an Integer_test.go
index 4c2ca800..ec98bb9f 100644
--- a/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer/1281. Subtract the Product and Sum of Digits of an Integer_test.go
+++ b/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer/1281. Subtract the Product and Sum of Digits of an Integer_test.go
@@ -26,12 +26,12 @@ func Test_Problem1281(t *testing.T) {
qs := []question1281{
- question1281{
+ {
para1281{234},
ans1281{15},
},
- question1281{
+ {
para1281{4421},
ans1281{21},
},
diff --git a/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold/1283. Find the Smallest Divisor Given a Threshold_test.go b/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold/1283. Find the Smallest Divisor Given a Threshold_test.go
index 24ef786a..e0bdbb27 100644
--- a/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold/1283. Find the Smallest Divisor Given a Threshold_test.go
+++ b/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold/1283. Find the Smallest Divisor Given a Threshold_test.go
@@ -27,17 +27,17 @@ func Test_Problem1283(t *testing.T) {
qs := []question1283{
- question1283{
+ {
para1283{[]int{1, 2, 5, 9}, 6},
ans1283{5},
},
- question1283{
+ {
para1283{[]int{2, 3, 5, 7, 11}, 11},
ans1283{3},
},
- question1283{
+ {
para1283{[]int{19}, 5},
ans1283{4},
},
diff --git a/leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array/1287. Element Appearing More Than 25% In Sorted Array_test.go b/leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array/1287. Element Appearing More Than 25% In Sorted Array_test.go
index 50edccd7..fe7cea6f 100644
--- a/leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array/1287. Element Appearing More Than 25% In Sorted Array_test.go
+++ b/leetcode/1287.Element-Appearing-More-Than-In-Sorted-Array/1287. Element Appearing More Than 25% In Sorted Array_test.go
@@ -26,7 +26,7 @@ func Test_Problem1287(t *testing.T) {
qs := []question1287{
- question1287{
+ {
para1287{[]int{1, 2, 2, 6, 6, 6, 6, 7, 10}},
ans1287{6},
},
diff --git a/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer/1290. Convert Binary Number in a Linked List to Integer_test.go b/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer/1290. Convert Binary Number in a Linked List to Integer_test.go
index 83186bdf..0a509b58 100644
--- a/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer/1290. Convert Binary Number in a Linked List to Integer_test.go
+++ b/leetcode/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer/1290. Convert Binary Number in a Linked List to Integer_test.go
@@ -28,27 +28,27 @@ func Test_Problem1290(t *testing.T) {
qs := []question1290{
- question1290{
+ {
para1290{[]int{1, 0, 1}},
ans1290{5},
},
- question1290{
+ {
para1290{[]int{0}},
ans1290{0},
},
- question1290{
+ {
para1290{[]int{1}},
ans1290{1},
},
- question1290{
+ {
para1290{[]int{0, 0}},
ans1290{0},
},
- question1290{
+ {
para1290{[]int{1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0}},
ans1290{18880},
},
diff --git a/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits/1295. Find Numbers with Even Number of Digits_test.go b/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits/1295. Find Numbers with Even Number of Digits_test.go
index 6f3cb6ec..df89aa0c 100644
--- a/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits/1295. Find Numbers with Even Number of Digits_test.go
+++ b/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits/1295. Find Numbers with Even Number of Digits_test.go
@@ -26,12 +26,12 @@ func Test_Problem1295(t *testing.T) {
qs := []question1295{
- question1295{
+ {
para1295{[]int{12, 345, 2, 6, 7896}},
ans1295{2},
},
- question1295{
+ {
para1295{[]int{555, 901, 482, 1771}},
ans1295{1},
},
diff --git a/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side/1299. Replace Elements with Greatest Element on Right Side_test.go b/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side/1299. Replace Elements with Greatest Element on Right Side_test.go
index 13c6ea81..d590320c 100644
--- a/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side/1299. Replace Elements with Greatest Element on Right Side_test.go
+++ b/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side/1299. Replace Elements with Greatest Element on Right Side_test.go
@@ -26,7 +26,7 @@ func Test_Problem1299(t *testing.T) {
qs := []question1299{
- question1299{
+ {
para1299{[]int{17, 18, 5, 4, 6, 1}},
ans1299{[]int{18, 6, 6, 6, 1, -1}},
},
diff --git a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go
index 71337a7c..9fca7e54 100644
--- a/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go
+++ b/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target/1300. Sum of Mutated Array Closest to Target_test.go
@@ -27,17 +27,17 @@ func Test_Problem1300(t *testing.T) {
qs := []question1300{
- question1300{
+ {
para1300{[]int{4, 9, 3}, 10},
ans1300{3},
},
- question1300{
+ {
para1300{[]int{2, 3, 5}, 10},
ans1300{5},
},
- question1300{
+ {
para1300{[]int{60864, 25176, 27249, 21296, 20204}, 56803},
ans1300{11361},
},
diff --git a/leetcode/1302.Deepest-Leaves-Sum/1302. Deepest Leaves Sum_test.go b/leetcode/1302.Deepest-Leaves-Sum/1302. Deepest Leaves Sum_test.go
index 94459050..b968b98e 100644
--- a/leetcode/1302.Deepest-Leaves-Sum/1302. Deepest Leaves Sum_test.go
+++ b/leetcode/1302.Deepest-Leaves-Sum/1302. Deepest Leaves Sum_test.go
@@ -28,12 +28,12 @@ func Test_Problem1302(t *testing.T) {
qs := []question1302{
- question1302{
+ {
para1302{[]int{1, 2, 3, 4, 5, structures.NULL, 6, 7, structures.NULL, structures.NULL, structures.NULL, structures.NULL, 8}},
ans1302{15},
},
- question1302{
+ {
para1302{[]int{}},
ans1302{0},
},
diff --git a/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero/1304. Find N Unique Integers Sum up to Zero_test.go b/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero/1304. Find N Unique Integers Sum up to Zero_test.go
index ab6131c5..91874da5 100644
--- a/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero/1304. Find N Unique Integers Sum up to Zero_test.go
+++ b/leetcode/1304.Find-N-Unique-Integers-Sum-up-to-Zero/1304. Find N Unique Integers Sum up to Zero_test.go
@@ -26,22 +26,22 @@ func Test_Problem1304(t *testing.T) {
qs := []question1304{
- question1304{
+ {
para1304{5},
ans1304{[]int{-7, -1, 1, 3, 4}},
},
- question1304{
+ {
para1304{0},
ans1304{[]int{}},
},
- question1304{
+ {
para1304{3},
ans1304{[]int{-1, 0, 1}},
},
- question1304{
+ {
para1304{1},
ans1304{[]int{0}},
},
diff --git a/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees/1305. All Elements in Two Binary Search Trees_test.go b/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees/1305. All Elements in Two Binary Search Trees_test.go
index 2c2278bb..979acc63 100644
--- a/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees/1305. All Elements in Two Binary Search Trees_test.go
+++ b/leetcode/1305.All-Elements-in-Two-Binary-Search-Trees/1305. All Elements in Two Binary Search Trees_test.go
@@ -29,27 +29,27 @@ func Test_Problem1305(t *testing.T) {
qs := []question1305{
- question1305{
+ {
para1305{[]int{2, 1, 4}, []int{1, 0, 3}},
ans1305{[]int{0, 1, 1, 2, 3, 4}},
},
- question1305{
+ {
para1305{[]int{0, -10, 10}, []int{5, 1, 7, 0, 2}},
ans1305{[]int{-10, 0, 0, 1, 2, 5, 7, 10}},
},
- question1305{
+ {
para1305{[]int{}, []int{5, 1, 7, 0, 2}},
ans1305{[]int{0, 1, 2, 5, 7}},
},
- question1305{
+ {
para1305{[]int{0, -10, 10}, []int{}},
ans1305{[]int{-10, 0, 10}},
},
- question1305{
+ {
para1305{[]int{1, structures.NULL, 8}, []int{8, 1}},
ans1305{[]int{1, 1, 8, 8}},
},
diff --git a/leetcode/1306.Jump-Game-III/1306. Jump Game III_test.go b/leetcode/1306.Jump-Game-III/1306. Jump Game III_test.go
index 886b81e9..1298ad75 100644
--- a/leetcode/1306.Jump-Game-III/1306. Jump Game III_test.go
+++ b/leetcode/1306.Jump-Game-III/1306. Jump Game III_test.go
@@ -27,17 +27,17 @@ func Test_Problem1306(t *testing.T) {
qs := []question1306{
- question1306{
+ {
para1306{[]int{4, 2, 3, 0, 3, 1, 2}, 5},
ans1306{true},
},
- question1306{
+ {
para1306{[]int{4, 2, 3, 0, 3, 1, 2}, 0},
ans1306{true},
},
- question1306{
+ {
para1306{[]int{3, 0, 2, 1, 2}, 2},
ans1306{false},
},
diff --git a/leetcode/1313.Decompress-Run-Length-Encoded-List/1313. Decompress Run-Length Encoded List_test.go b/leetcode/1313.Decompress-Run-Length-Encoded-List/1313. Decompress Run-Length Encoded List_test.go
index 18608311..ce5cad62 100644
--- a/leetcode/1313.Decompress-Run-Length-Encoded-List/1313. Decompress Run-Length Encoded List_test.go
+++ b/leetcode/1313.Decompress-Run-Length-Encoded-List/1313. Decompress Run-Length Encoded List_test.go
@@ -26,17 +26,17 @@ func Test_Problem1313(t *testing.T) {
qs := []question1313{
- question1313{
+ {
para1313{[]int{1, 2, 3, 4}},
ans1313{[]int{2, 4, 4, 4}},
},
- question1313{
+ {
para1313{[]int{1, 1, 2, 3}},
ans1313{[]int{1, 3, 3}},
},
- question1313{
+ {
para1313{[]int{}},
ans1313{[]int{}},
},
diff --git a/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers/1317. Convert Integer to the Sum of Two No-Zero Integers_test.go b/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers/1317. Convert Integer to the Sum of Two No-Zero Integers_test.go
index a4283613..b39cf2ff 100644
--- a/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers/1317. Convert Integer to the Sum of Two No-Zero Integers_test.go
+++ b/leetcode/1317.Convert-Integer-to-the-Sum-of-Two-No-Zero-Integers/1317. Convert Integer to the Sum of Two No-Zero Integers_test.go
@@ -26,47 +26,47 @@ func Test_Problem1317(t *testing.T) {
qs := []question1317{
- question1317{
+ {
para1317{5},
ans1317{[]int{1, 4}},
},
- question1317{
+ {
para1317{0},
ans1317{[]int{}},
},
- question1317{
+ {
para1317{3},
ans1317{[]int{1, 2}},
},
- question1317{
+ {
para1317{1},
ans1317{[]int{}},
},
- question1317{
+ {
para1317{2},
ans1317{[]int{1, 1}},
},
- question1317{
+ {
para1317{11},
ans1317{[]int{2, 9}},
},
- question1317{
+ {
para1317{10000},
ans1317{[]int{1, 9999}},
},
- question1317{
+ {
para1317{69},
ans1317{[]int{1, 68}},
},
- question1317{
+ {
para1317{1010},
ans1317{[]int{11, 999}},
},
diff --git a/leetcode/1380.Lucky-Numbers-in-a-Matrix/1380. Lucky Numbers in a Matrix_test.go b/leetcode/1380.Lucky-Numbers-in-a-Matrix/1380. Lucky Numbers in a Matrix_test.go
index 63ff58ea..73d9f314 100644
--- a/leetcode/1380.Lucky-Numbers-in-a-Matrix/1380. Lucky Numbers in a Matrix_test.go
+++ b/leetcode/1380.Lucky-Numbers-in-a-Matrix/1380. Lucky Numbers in a Matrix_test.go
@@ -26,23 +26,23 @@ func Test_Problem1380(t *testing.T) {
qs := []question1380{
- question1380{
- para1380{[][]int{[]int{3, 7, 8}, []int{9, 11, 13}, []int{15, 16, 17}}},
+ {
+ para1380{[][]int{{3, 7, 8}, {9, 11, 13}, {15, 16, 17}}},
ans1380{[]int{15}},
},
- question1380{
- para1380{[][]int{[]int{1, 10, 4, 2}, []int{9, 3, 8, 7}, []int{15, 16, 17, 12}}},
+ {
+ para1380{[][]int{{1, 10, 4, 2}, {9, 3, 8, 7}, {15, 16, 17, 12}}},
ans1380{[]int{12}},
},
- question1380{
- para1380{[][]int{[]int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5}}},
+ {
+ para1380{[][]int{{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}}},
ans1380{[]int{1}},
},
- question1380{
- para1380{[][]int{[]int{7, 8}, []int{1, 2}}},
+ {
+ para1380{[][]int{{7, 8}, {1, 2}}},
ans1380{[]int{7}},
},
// 如需多个测试,可以复制上方元素。
diff --git a/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays/1385. Find the Distance Value Between Two Arrays_test.go b/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays/1385. Find the Distance Value Between Two Arrays_test.go
index cbdfd0b5..070bf12a 100644
--- a/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays/1385. Find the Distance Value Between Two Arrays_test.go
+++ b/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays/1385. Find the Distance Value Between Two Arrays_test.go
@@ -28,17 +28,17 @@ func Test_Problem1385(t *testing.T) {
qs := []question1385{
- question1385{
+ {
para1385{[]int{4, 5, 8}, []int{10, 9, 1, 8}, 2},
ans1385{[]int{2}},
},
- question1385{
+ {
para1385{[]int{1, 4, 2, 3}, []int{-4, -3, 6, 10, 20, 30}, 3},
ans1385{[]int{2}},
},
- question1385{
+ {
para1385{[]int{2, 1, 100, 3}, []int{-5, -2, 10, -3, 7}, 6},
ans1385{[]int{1}},
},
diff --git a/leetcode/1389.Create-Target-Array-in-the-Given-Order/1389. Create Target Array in the Given Order_test.go b/leetcode/1389.Create-Target-Array-in-the-Given-Order/1389. Create Target Array in the Given Order_test.go
index 3eb5ee1f..779d36df 100644
--- a/leetcode/1389.Create-Target-Array-in-the-Given-Order/1389. Create Target Array in the Given Order_test.go
+++ b/leetcode/1389.Create-Target-Array-in-the-Given-Order/1389. Create Target Array in the Given Order_test.go
@@ -27,17 +27,17 @@ func Test_Problem1389(t *testing.T) {
qs := []question1389{
- question1389{
+ {
para1389{[]int{0, 1, 2, 3, 4}, []int{0, 1, 2, 2, 1}},
ans1389{[]int{0, 4, 1, 3, 2}},
},
- question1389{
+ {
para1389{[]int{1, 2, 3, 4, 0}, []int{0, 1, 2, 3, 0}},
ans1389{[]int{0, 1, 2, 3, 4}},
},
- question1389{
+ {
para1389{[]int{1}, []int{0}},
ans1389{[]int{1}},
},
diff --git a/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_test.go b/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_test.go
index 22607f7c..315483bd 100644
--- a/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_test.go
+++ b/leetcode/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence/1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence_test.go
@@ -27,27 +27,27 @@ func Test_Problem1455(t *testing.T) {
qs := []question1455{
- question1455{
+ {
para1455{"i love eating burger", "burg"},
ans1455{4},
},
- question1455{
+ {
para1455{"this problem is an easy problem", "pro"},
ans1455{2},
},
- question1455{
+ {
para1455{"i am tired", "you"},
ans1455{-1},
},
- question1455{
+ {
para1455{"i use triple pillow", "pill"},
ans1455{4},
},
- question1455{
+ {
para1455{"hello from the other side", "they"},
ans1455{-1},
},
diff --git a/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array/1464. Maximum Product of Two Elements in an Array_test.go b/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array/1464. Maximum Product of Two Elements in an Array_test.go
index 06c9821f..93b56c8b 100644
--- a/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array/1464. Maximum Product of Two Elements in an Array_test.go
+++ b/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array/1464. Maximum Product of Two Elements in an Array_test.go
@@ -26,22 +26,22 @@ func Test_Problem1464(t *testing.T) {
qs := []question1464{
- question1464{
+ {
para1464{[]int{3, 4, 5, 2}},
ans1464{12},
},
- question1464{
+ {
para1464{[]int{1, 5, 4, 5}},
ans1464{16},
},
- question1464{
+ {
para1464{[]int{3, 7}},
ans1464{12},
},
- question1464{
+ {
para1464{[]int{1}},
ans1464{0},
},
diff --git a/leetcode/1470.Shuffle-the-Array/1470. Shuffle the Array_test.go b/leetcode/1470.Shuffle-the-Array/1470. Shuffle the Array_test.go
index 212ecef9..e273744e 100644
--- a/leetcode/1470.Shuffle-the-Array/1470. Shuffle the Array_test.go
+++ b/leetcode/1470.Shuffle-the-Array/1470. Shuffle the Array_test.go
@@ -27,17 +27,17 @@ func Test_Problem1470(t *testing.T) {
qs := []question1470{
- question1470{
+ {
para1470{[]int{2, 5, 1, 3, 4, 7}, 3},
ans1470{[]int{2, 3, 5, 4, 1, 7}},
},
- question1470{
+ {
para1470{[]int{1, 2, 3, 4, 4, 3, 2, 1}, 4},
ans1470{[]int{1, 4, 2, 3, 3, 2, 4, 1}},
},
- question1470{
+ {
para1470{[]int{1, 1, 2, 2}, 2},
ans1470{[]int{1, 2, 1, 2}},
},
diff --git a/leetcode/9990085.Maximal-Rectangle/85. Maximal Rectangle_test.go b/leetcode/9990085.Maximal-Rectangle/85. Maximal Rectangle_test.go
index 12853fbf..d4dd5a4c 100644
--- a/leetcode/9990085.Maximal-Rectangle/85. Maximal Rectangle_test.go
+++ b/leetcode/9990085.Maximal-Rectangle/85. Maximal Rectangle_test.go
@@ -26,8 +26,8 @@ func Test_Problem85(t *testing.T) {
qs := []question85{
- question85{
- para85{[][]byte{[]byte{'1', '0', '1', '0', '0'}, []byte{'1', '0', '1', '1', '1'}, []byte{'1', '1', '1', '1', '1'}, []byte{'1', '0', '0', '1', '0'}}},
+ {
+ para85{[][]byte{{'1', '0', '1', '0', '0'}, {'1', '0', '1', '1', '1'}, {'1', '1', '1', '1', '1'}, {'1', '0', '0', '1', '0'}}},
ans85{6},
},
}
diff --git a/leetcode/9990132.Palindrome-Partitioning-II/132. Palindrome Partitioning II_test.go b/leetcode/9990132.Palindrome-Partitioning-II/132. Palindrome Partitioning II_test.go
index 1588e30a..b7acf949 100644
--- a/leetcode/9990132.Palindrome-Partitioning-II/132. Palindrome Partitioning II_test.go
+++ b/leetcode/9990132.Palindrome-Partitioning-II/132. Palindrome Partitioning II_test.go
@@ -26,7 +26,7 @@ func Test_Problem132(t *testing.T) {
qs := []question132{
- question132{
+ {
para132{"aab"},
ans132{1},
},
diff --git a/leetcode/9990316.Remove-Duplicate-Letters/316. Remove Duplicate Letters_test.go b/leetcode/9990316.Remove-Duplicate-Letters/316. Remove Duplicate Letters_test.go
index 9768dbb3..8ec7713a 100644
--- a/leetcode/9990316.Remove-Duplicate-Letters/316. Remove Duplicate Letters_test.go
+++ b/leetcode/9990316.Remove-Duplicate-Letters/316. Remove Duplicate Letters_test.go
@@ -26,11 +26,11 @@ func Test_Problem316(t *testing.T) {
qs := []question316{
- question316{
+ {
para316{"bcabc"},
ans316{"abc"},
},
- question316{
+ {
para316{"cbacdcbc"},
ans316{"acdb"},
},
diff --git a/leetcode/9990352.Data-Stream-as-Disjoint-Intervals/352. Data Stream as Disjoint Intervals.go b/leetcode/9990352.Data-Stream-as-Disjoint-Intervals/352. Data Stream as Disjoint Intervals.go
index 58b045b5..eab0e5b6 100644
--- a/leetcode/9990352.Data-Stream-as-Disjoint-Intervals/352. Data Stream as Disjoint Intervals.go
+++ b/leetcode/9990352.Data-Stream-as-Disjoint-Intervals/352. Data Stream as Disjoint Intervals.go
@@ -21,7 +21,7 @@ func Constructor352() SummaryRanges {
func (sr *SummaryRanges) AddNum(val int) {
if sr.intervals == nil {
sr.intervals = []Interval{
- Interval{
+ {
Start: val,
End: val,
},
diff --git a/leetcode/9990363.Max-Sum-of-Rectangle-No-Larger-Than-K/363. Max Sum of Rectangle No Larger Than K_test.go b/leetcode/9990363.Max-Sum-of-Rectangle-No-Larger-Than-K/363. Max Sum of Rectangle No Larger Than K_test.go
index 09cfe875..9c62eb0f 100644
--- a/leetcode/9990363.Max-Sum-of-Rectangle-No-Larger-Than-K/363. Max Sum of Rectangle No Larger Than K_test.go
+++ b/leetcode/9990363.Max-Sum-of-Rectangle-No-Larger-Than-K/363. Max Sum of Rectangle No Larger Than K_test.go
@@ -27,23 +27,23 @@ func Test_Problem363(t *testing.T) {
qs := []question363{
- question363{
- para363{[][]int{[]int{1, 0, 1}, []int{0, -2, 3}}, 2},
+ {
+ para363{[][]int{{1, 0, 1}, {0, -2, 3}}, 2},
ans363{2},
},
- question363{
- para363{[][]int{[]int{2, 2, -1}}, 0},
+ {
+ para363{[][]int{{2, 2, -1}}, 0},
ans363{-1},
},
- question363{
- para363{[][]int{[]int{5, -4, -3, 4}, []int{-3, -4, 4, 5}, []int{5, 1, 5, -4}}, 8},
+ {
+ para363{[][]int{{5, -4, -3, 4}, {-3, -4, 4, 5}, {5, 1, 5, -4}}, 8},
ans363{8},
},
- question363{
- para363{[][]int{[]int{5, -4, -3, 4}, []int{-3, -4, 4, 5}, []int{5, 1, 5, -4}}, 3},
+ {
+ para363{[][]int{{5, -4, -3, 4}, {-3, -4, 4, 5}, {5, 1, 5, -4}}, 3},
ans363{2},
},
}
diff --git a/leetcode/9990377.Combination-Sum-IV/377. Combination Sum IV_test.go b/leetcode/9990377.Combination-Sum-IV/377. Combination Sum IV_test.go
index 56de0654..de17f246 100644
--- a/leetcode/9990377.Combination-Sum-IV/377. Combination Sum IV_test.go
+++ b/leetcode/9990377.Combination-Sum-IV/377. Combination Sum IV_test.go
@@ -27,12 +27,12 @@ func Test_Problem377(t *testing.T) {
qs := []question377{
- question377{
+ {
para377{[]int{1, 2, 3}, 4},
ans377{7},
},
- question377{
+ {
para377{[]int{1, 2, 3}, 32},
ans377{7},
},
diff --git a/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go b/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go
index 05c97087..0d3306d1 100644
--- a/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go
+++ b/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go
@@ -5,7 +5,7 @@ import (
)
func oddEvenJumps(A []int) int {
- oddJumpMap, evenJumpMap, count, current, res := map[int]int{}, map[int]int{}, 1, 0, 0
+ oddJumpMap, evenJumpMap, current, res := map[int]int{}, map[int]int{}, 0, 0
for i := 0; i < len(A); i++ {
for j := i + 1; j < len(A); j++ {
if v, ok := oddJumpMap[i]; ok {
@@ -42,7 +42,8 @@ func oddEvenJumps(A []int) int {
}
fmt.Printf("oddJumpMap = %v evenJumpMap = %v\n", oddJumpMap, evenJumpMap)
for i := 0; i < len(A); i++ {
- count, current = 1, i
+ count := 1
+ current = i
for {
if count%2 == 1 {
if v, ok := oddJumpMap[current]; ok {
diff --git a/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump_test.go b/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump_test.go
index c8565314..899c73c7 100644
--- a/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump_test.go
+++ b/leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump_test.go
@@ -26,17 +26,17 @@ func Test_Problem975(t *testing.T) {
qs := []question975{
- question975{
+ {
para975{[]int{10, 13, 12, 14, 15}},
ans975{2},
},
- question975{
+ {
para975{[]int{2, 3, 1, 1, 4}},
ans975{3},
},
- question975{
+ {
para975{[]int{5, 1, 3, 4, 2}},
ans975{3},
},
diff --git a/leetcode/9991044.Longest-Duplicate-Substring/1044. Longest Duplicate Substring_test.go b/leetcode/9991044.Longest-Duplicate-Substring/1044. Longest Duplicate Substring_test.go
index 15b19927..e09ceac6 100644
--- a/leetcode/9991044.Longest-Duplicate-Substring/1044. Longest Duplicate Substring_test.go
+++ b/leetcode/9991044.Longest-Duplicate-Substring/1044. Longest Duplicate Substring_test.go
@@ -25,12 +25,12 @@ type ans1044 struct {
func Test_Problem1044(t *testing.T) {
qs := []question1044{
- question1044{
+ {
para1044{"banana"},
ans1044{"ana"},
},
- question1044{
+ {
para1044{"abcd"},
ans1044{""},
},
diff --git a/leetcode/9991292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equal-to-Threshold/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_test.go b/leetcode/9991292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equal-to-Threshold/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_test.go
index d731d517..0c713cd1 100644
--- a/leetcode/9991292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equal-to-Threshold/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_test.go
+++ b/leetcode/9991292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equal-to-Threshold/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_test.go
@@ -27,13 +27,13 @@ func Test_Problem1292(t *testing.T) {
qs := []question1292{
- question1292{
- para1292{[][]int{[]int{1, 1, 3, 2, 4, 3, 2}, []int{1, 1, 3, 2, 4, 3, 2}, []int{1, 1, 3, 2, 4, 3, 2}}, 4},
+ {
+ para1292{[][]int{{1, 1, 3, 2, 4, 3, 2}, {1, 1, 3, 2, 4, 3, 2}, {1, 1, 3, 2, 4, 3, 2}}, 4},
ans1292{2},
},
- question1292{
- para1292{[][]int{[]int{2, 2, 2, 2, 2}, []int{2, 2, 2, 2, 2}, []int{2, 2, 2, 2, 2}, []int{2, 2, 2, 2, 2}, []int{2, 2, 2, 2, 2}}, 1},
+ {
+ para1292{[][]int{{2, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 2, 2, 2, 2}}, 1},
ans1292{0},
},
}
diff --git a/structures/Interval.go b/structures/Interval.go
index 77715216..bed1432e 100644
--- a/structures/Interval.go
+++ b/structures/Interval.go
@@ -50,4 +50,4 @@ func partitionSort(a []Interval, lo, hi int) int {
}
a[i+1], a[hi] = a[hi], a[i+1]
return i + 1
-}
\ No newline at end of file
+}
diff --git a/structures/Interval_test.go b/structures/Interval_test.go
index aeb83704..dd36e40a 100644
--- a/structures/Interval_test.go
+++ b/structures/Interval_test.go
@@ -19,19 +19,19 @@ func Test_IntervalSlice2Intss(t *testing.T) {
actual := IntervalSlice2Intss(
[]Interval{
- Interval{
+ {
Start: 1,
End: 2,
},
- Interval{
+ {
Start: 3,
End: 4,
},
},
)
expected := [][]int{
- []int{1, 2},
- []int{3, 4},
+ {1, 2},
+ {3, 4},
}
ast.Equal(expected, actual)
@@ -40,18 +40,18 @@ func Test_Intss2IntervalSlice(t *testing.T) {
ast := assert.New(t)
expected := []Interval{
- Interval{
+ {
Start: 1,
End: 2,
},
- Interval{
+ {
Start: 3,
End: 4,
},
}
actual := Intss2IntervalSlice([][]int{
- []int{1, 2},
- []int{3, 4},
+ {1, 2},
+ {3, 4},
},
)
diff --git a/structures/Point_test.go b/structures/Point_test.go
index 9282179e..48b6dc1c 100644
--- a/structures/Point_test.go
+++ b/structures/Point_test.go
@@ -26,11 +26,11 @@ func Test_Intss2Points(t *testing.T) {
},
},
[]Point{
- Point{X: 1, Y: 0},
- Point{X: 2, Y: 0},
- Point{X: 3, Y: 0},
- Point{X: 4, Y: 0},
- Point{X: 5, Y: 0},
+ {X: 1, Y: 0},
+ {X: 2, Y: 0},
+ {X: 3, Y: 0},
+ {X: 4, Y: 0},
+ {X: 5, Y: 0},
},
},
}
@@ -54,11 +54,11 @@ func Test_Points2Intss(t *testing.T) {
"测试 [][]int 转换成 []Point ",
args{
[]Point{
- Point{X: 1, Y: 0},
- Point{X: 2, Y: 0},
- Point{X: 3, Y: 0},
- Point{X: 4, Y: 0},
- Point{X: 5, Y: 0},
+ {X: 1, Y: 0},
+ {X: 2, Y: 0},
+ {X: 3, Y: 0},
+ {X: 4, Y: 0},
+ {X: 5, Y: 0},
},
},
[][]int{
diff --git a/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md b/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md
index 196dd6a5..e0811e92 100644
--- a/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md
+++ b/website/content/ChapterFour/0080.Remove-Duplicates-from-Sorted-Array-II.md
@@ -71,9 +71,9 @@ func removeDuplicates80(nums []int) int {
if len(nums) == 0 {
return 0
}
- last, finder, startFinder := 0, 0, -1
+ last, finder := 0, 0
for last < len(nums)-1 {
- startFinder = -1
+ startFinder := -1
for nums[finder] == nums[last] {
if startFinder == -1 || startFinder > finder {
startFinder = finder
@@ -101,4 +101,5 @@ func removeDuplicates80(nums []int) int {
return last + 1
}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md b/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md
index 20386399..790470c1 100755
--- a/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md
+++ b/website/content/ChapterFour/0095.Unique-Binary-Search-Trees-II.md
@@ -62,10 +62,9 @@ func generateBSTree(start, end int) []*TreeNode {
tree = append(tree, nil)
return tree
}
- left, right := []*TreeNode{}, []*TreeNode{}
for i := start; i <= end; i++ {
- left = generateBSTree(start, i-1)
- right = generateBSTree(i+1, end)
+ left := generateBSTree(start, i-1)
+ right := generateBSTree(i+1, end)
for _, l := range left {
for _, r := range right {
root := &TreeNode{Val: i, Left: l, Right: r}
diff --git a/website/content/ChapterFour/0147.Insertion-Sort-List.md b/website/content/ChapterFour/0147.Insertion-Sort-List.md
index 7b60283b..80bedc45 100644
--- a/website/content/ChapterFour/0147.Insertion-Sort-List.md
+++ b/website/content/ChapterFour/0147.Insertion-Sort-List.md
@@ -60,11 +60,9 @@ func insertionSortList(head *ListNode) *ListNode {
return head
}
newHead := &ListNode{Val: 0, Next: nil} // 这里初始化不要直接指向 head,为了下面循环可以统一处理
- cur := head
- pre := newHead
- next := &ListNode{Val: 0, Next: nil}
+ cur, pre := head, newHead
for cur != nil {
- next = cur.Next
+ next := cur.Next
for pre.Next != nil && pre.Next.Val < cur.Val {
pre = pre.Next
}
diff --git a/website/content/ChapterFour/0224.Basic-Calculator.md b/website/content/ChapterFour/0224.Basic-Calculator.md
index 041f8382..5861726a 100755
--- a/website/content/ChapterFour/0224.Basic-Calculator.md
+++ b/website/content/ChapterFour/0224.Basic-Calculator.md
@@ -97,7 +97,7 @@ func calculate1(s string) int {
break
}
}
- tmp = string(stack[index+1 : len(stack)])
+ tmp = string(stack[index+1:])
stack = stack[:index]
res := strconv.Itoa(calculateStr(tmp))
for j := 0; j < len(res); j++ {
@@ -142,7 +142,6 @@ func calculateStr(str string) int {
if tmpStr != "" {
num, _ := strconv.Atoi(tmpStr)
nums = append(nums, num)
- tmpStr = ""
}
res = nums[0]
for i := 0; i < len(s); i++ {
@@ -156,4 +155,11 @@ func calculateStr(str string) int {
return res
}
+func isDigital(v byte) bool {
+ if v >= '0' && v <= '9' {
+ return true
+ }
+ return false
+}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0392.Is-Subsequence.md b/website/content/ChapterFour/0392.Is-Subsequence.md
index 06b92fe7..09ff2c75 100755
--- a/website/content/ChapterFour/0392.Is-Subsequence.md
+++ b/website/content/ChapterFour/0392.Is-Subsequence.md
@@ -46,9 +46,9 @@ package leetcode
// 解法一 O(n^2)
func isSubsequence(s string, t string) bool {
- index, flag := 0, false
+ index := 0
for i := 0; i < len(s); i++ {
- flag = false
+ flag := false
for ; index < len(t); index++ {
if s[i] == t[index] {
flag = true
@@ -76,4 +76,5 @@ func isSubsequence1(s string, t string) bool {
return len(s) == 0
}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md b/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md
index 2c0681db..8e54fbcc 100644
--- a/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md
+++ b/website/content/ChapterFour/0424.Longest-Repeating-Character-Replacement.md
@@ -62,8 +62,8 @@ The substring "BBBB" has the longest repeating letters, which is 4.
package leetcode
func characterReplacement(s string, k int) int {
- res, left, right, counter, freq := 0, 0, 1, 0, make([]int, 26)
- for right = 0; right < len(s); right++ {
+ res, left, counter, freq := 0, 0, 0, make([]int, 26)
+ for right := 0; right < len(s); right++ {
freq[s[right]-'A']++
counter = max(counter, freq[s[right]-'A'])
for right-left+1-counter > k {
@@ -75,4 +75,11 @@ func characterReplacement(s string, k int) int {
return res
}
+func max(a int, b int) int {
+ if a > b {
+ return a
+ }
+ return b
+}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0496.Next-Greater-Element-I.md b/website/content/ChapterFour/0496.Next-Greater-Element-I.md
index 7c2aafb4..2a62ef32 100644
--- a/website/content/ChapterFour/0496.Next-Greater-Element-I.md
+++ b/website/content/ChapterFour/0496.Next-Greater-Element-I.md
@@ -57,12 +57,12 @@ func nextGreaterElement(nums1 []int, nums2 []int) []int {
if len(nums1) == 0 || len(nums2) == 0 {
return []int{}
}
- res, reocrd, flag := []int{}, map[int]int{}, false
+ res, reocrd := []int{}, map[int]int{}
for i, v := range nums2 {
reocrd[v] = i
}
for i := 0; i < len(nums1); i++ {
- flag = false
+ flag := false
for j := reocrd[nums1[i]]; j < len(nums2); j++ {
if nums2[j] > nums1[i] {
res = append(res, nums2[j])
diff --git a/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md b/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md
index 7a737553..6c7fdf87 100644
--- a/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md
+++ b/website/content/ChapterFour/0725.Split-Linked-List-in-Parts.md
@@ -87,9 +87,8 @@ func splitListToParts(root *ListNode, k int) []*ListNode {
length := getLength(root)
splitNum := length / k
lengNum := length % k
- cur := root
- head := root
- pre := root
+ cur, head := root, root
+ var pre *ListNode
fmt.Printf("总长度 %v, 分 %v 组, 前面 %v 组长度为 %v, 剩余 %v 组,每组 %v\n", length, k, lengNum, splitNum+1, k-lengNum, splitNum)
if splitNum == 0 {
for i := 0; i < k; i++ {
@@ -130,4 +129,14 @@ func splitListToParts(root *ListNode, k int) []*ListNode {
return res
}
+func getLength(l *ListNode) int {
+ count := 0
+ cur := l
+ for cur != nil {
+ count++
+ cur = cur.Next
+ }
+ return count
+}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md b/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md
index e75636fe..49ebc4c0 100644
--- a/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md
+++ b/website/content/ChapterFour/0828.COPYRIGHT-PROBLEM-XXX.md
@@ -55,10 +55,9 @@ func uniqueLetterString1(S string) int {
if len(S) == 0 {
return 0
}
- letterMap := map[byte]int{}
res, mod := 0, 1000000007
for i := 0; i < len(S); i++ {
- letterMap = map[byte]int{}
+ letterMap := map[byte]int{}
for j := i; j < len(S); j++ {
letterMap[S[j]]++
tmp := 0
@@ -77,4 +76,5 @@ func uniqueLetterString1(S string) int {
return res % mod
}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md b/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md
index 4c1946f3..44076d30 100755
--- a/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md
+++ b/website/content/ChapterFour/0897.Increasing-Order-Search-Tree.md
@@ -97,12 +97,12 @@ func recBST(root, tail *TreeNode) *TreeNode {
// 解法二 模拟
func increasingBST1(root *TreeNode) *TreeNode {
- list, newRoot := []int{}, &TreeNode{}
+ list := []int{}
inorder(root, &list)
if len(list) == 0 {
return root
}
- newRoot = &TreeNode{Val: list[0], Left: nil, Right: nil}
+ newRoot := &TreeNode{Val: list[0], Left: nil, Right: nil}
cur := newRoot
for index := 1; index < len(list); index++ {
tmp := &TreeNode{Val: list[index], Left: nil, Right: nil}
@@ -112,4 +112,12 @@ func increasingBST1(root *TreeNode) *TreeNode {
return newRoot
}
+func inorder(root *TreeNode, output *[]int) {
+ if root != nil {
+ inorder(root.Left, output)
+ *output = append(*output, root.Val)
+ inorder(root.Right, output)
+ }
+}
+
```
\ No newline at end of file
diff --git a/website/content/ChapterFour/0980.Unique-Paths-III.md b/website/content/ChapterFour/0980.Unique-Paths-III.md
index 5e0c30ee..94f53c18 100755
--- a/website/content/ChapterFour/0980.Unique-Paths-III.md
+++ b/website/content/ChapterFour/0980.Unique-Paths-III.md
@@ -69,6 +69,13 @@ Return the number of 4-directional walks from the starting square to the ending
package leetcode
+var dir = [][]int{
+ {-1, 0},
+ {0, 1},
+ {1, 0},
+ {0, -1},
+}
+
func uniquePathsIII(grid [][]int) int {
visited := make([][]bool, len(grid))
for i := 0; i < len(visited); i++ {
@@ -115,7 +122,7 @@ func findUniquePathIII(board [][]int, visited [][]bool, path []int, empty, start
}
}
visited[startx][starty] = false
- empty++
+ //empty++ 这里虽然可以还原这个变量值,但是赋值没有意义,干脆不写了
path = path[:len(path)-2]
}
return