Skip to content

Commit a2bdbb7

Browse files
authored
Merge pull request halfrost#33 from halfrost/test_travis-ci
change path
2 parents 1934e38 + 1081638 commit a2bdbb7

File tree

238 files changed

+2024
-460
lines changed

Some content is hidden

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

238 files changed

+2024
-460
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ go:
77
branches:
88
only:
99
- master
10-
- stable
1110

1211
script:
1312
- go get -t -v ./...

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}",
13+
"env": {},
14+
"args": []
15+
}
16+
]
17+
}

Algorithms/0002. Add Two Numbers/2. Add Two Numbers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
package leetcode
22

3+
import (
4+
"github.com/halfrost/LeetCode-Go/structures"
5+
)
6+
7+
// ListNode define
8+
type ListNode = structures.ListNode
9+
310
/**
411
* Definition for singly-linked list.
512
* type ListNode struct {
613
* Val int
714
* Next *ListNode
815
* }
916
*/
17+
1018
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
1119
if l1 == nil || l2 == nil {
1220
return nil

Algorithms/0002. Add Two Numbers/2. Add Two Numbers_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package leetcode
33
import (
44
"fmt"
55
"testing"
6+
7+
"github.com/halfrost/LeetCode-Go/structures"
68
)
79

810
type question2 struct {
@@ -73,7 +75,7 @@ func Test_Problem2(t *testing.T) {
7375

7476
for _, q := range qs {
7577
_, p := q.ans2, q.para2
76-
fmt.Printf("【input】:%v 【output】:%v\n", p, L2s(addTwoNumbers(S2l(p.one), S2l(p.another))))
78+
fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(addTwoNumbers(structures.Ints2List(p.one), structures.Ints2List(p.another))))
7779
}
7880
fmt.Printf("\n\n\n")
7981
}

Algorithms/0003. Longest Substring Without Repeating Characters/3. Longest Substring Without Repeating Characters.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ func lengthOfLongestSubstring(s string) int {
2020
}
2121
return result
2222
}
23+
24+
func max(a int, b int) int {
25+
if a > b {
26+
return a
27+
}
28+
return b
29+
}

Algorithms/0004. Median of Two Sorted Arrays/4. Median of Two Sorted Arrays.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ func findMedianSortedArrays(nums1 []int, nums2 []int) float64 {
4141
}
4242
return float64(midLeft+midRight) / 2
4343
}
44+
45+
func max(a int, b int) int {
46+
if a > b {
47+
return a
48+
}
49+
return b
50+
}
51+
52+
func min(a int, b int) int {
53+
if a > b {
54+
return b
55+
}
56+
return a
57+
}

Algorithms/0019. Remove Nth Node From End of List/19. Remove Nth Node From End of List.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package leetcode
22

3+
import (
4+
"github.com/halfrost/LeetCode-Go/structures"
5+
)
6+
7+
// ListNode define
8+
type ListNode = structures.ListNode
9+
310
/**
411
* Definition for singly-linked list.
512
* type ListNode struct {

Algorithms/0019. Remove Nth Node From End of List/19. Remove Nth Node From End of List_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package leetcode
33
import (
44
"fmt"
55
"testing"
6+
7+
"github.com/halfrost/LeetCode-Go/structures"
68
)
79

810
type question19 struct {
@@ -50,23 +52,13 @@ func Test_Problem19(t *testing.T) {
5052
para19{[]int{1, 2, 3, 4, 5}, 5},
5153
ans19{[]int{2, 3, 4, 5}},
5254
},
53-
54-
question19{
55-
para19{[]int{1, 2, 3, 4, 5}, 0},
56-
ans19{[]int{1, 2, 3, 4, 5}},
57-
},
58-
59-
question19{
60-
para19{[]int{1, 2, 3, 4, 5}, 10},
61-
ans19{[]int{1, 2, 3, 4, 5}},
62-
},
6355
}
6456

6557
fmt.Printf("------------------------Leetcode Problem 19------------------------\n")
6658

6759
for _, q := range qs {
6860
_, p := q.ans19, q.para19
69-
fmt.Printf("【input】:%v 【output】:%v\n", p, L2s(removeNthFromEnd(S2l(p.one), p.n)))
61+
fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(removeNthFromEnd(structures.Ints2List(p.one), p.n)))
7062
}
7163
fmt.Printf("\n\n\n")
7264
}

Algorithms/0021. Merge Two Sorted Lists/21. Merge Two Sorted Lists.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package leetcode
22

3+
import (
4+
"github.com/halfrost/LeetCode-Go/structures"
5+
)
6+
7+
// ListNode define
8+
type ListNode = structures.ListNode
9+
310
/**
411
* Definition for singly-linked list.
512
* type ListNode struct {

Algorithms/0021. Merge Two Sorted Lists/21. Merge Two Sorted Lists_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package leetcode
33
import (
44
"fmt"
55
"testing"
6+
7+
"github.com/halfrost/LeetCode-Go/structures"
68
)
79

810
type question21 struct {
@@ -73,7 +75,7 @@ func Test_Problem21(t *testing.T) {
7375

7476
for _, q := range qs {
7577
_, p := q.ans21, q.para21
76-
fmt.Printf("【input】:%v 【output】:%v\n", p, L2s(mergeTwoLists(S2l(p.one), S2l(p.another))))
78+
fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(mergeTwoLists(structures.Ints2List(p.one), structures.Ints2List(p.another))))
7779
}
7880
fmt.Printf("\n\n\n")
7981
}

0 commit comments

Comments
 (0)