Skip to content

Commit 5c8b72c

Browse files
committed
Using go modules to manage godeps
1 parent 231120a commit 5c8b72c

Some content is hidden

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

48 files changed

+77
-60
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111

1212
# Output of the go coverage tool, specifically when used with LiteIDE
1313
*.out
14+
vendor

algorithms/binarysearch/69.mySqrt_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
package binarysearch
22

3-
import "testing"
3+
import (
4+
"testing"
5+
6+
"Leetcode/algorithms/kit"
7+
)
48

59
// run: go test -v 69.*
610
func Test_mySqrt(t *testing.T) {
7-
cases := []struct {
8-
name string
9-
input, expected int
10-
}{
11-
{"x0", 1, 1},
12-
{"x1", 2, 1},
13-
{"x2", 4, 2},
14-
{"x3", 5, 2},
15-
{"x4", 8, 2},
16-
{"x5", 9, 3},
17-
{"x6", 100, 10},
11+
cases := []kit.CaseEntry{
12+
{
13+
Name: "x1",
14+
Input: 1,
15+
Expected: 1,
16+
},
1817
}
1918

2019
for _, tt := range cases {
21-
t.Run(tt.name, func(t *testing.T) {
22-
if output := mySqrt(tt.input); output != tt.expected {
23-
t.Errorf("mySqrt(%d)=%d, expected=%d", tt.input, output, tt.expected)
20+
t.Run(tt.Name, func(t *testing.T) {
21+
if output := mySqrt(tt.Input.(int)); output != tt.Expected.(int) {
22+
t.Errorf("mySqrt(%d)=%d, expected=%d", tt.Input, output, tt.Expected)
2423
}
2524
})
2625
}

algorithms/linkedList/141.hasCycle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package linkedList
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
type (

algorithms/linkedList/148.sortList_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v base.go 148.*

algorithms/linkedList/19.removeNthFromEnd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
type (

algorithms/linkedList/2.addTwoNumbers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// run: go test -v base.go 2.*

algorithms/linkedList/206.reverseList.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package linkedList
33
import (
44
"fmt"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
func reverseList(head *ListNode) *ListNode {

algorithms/linkedList/206.reverseList_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// run: go test -v base.go 206.*

algorithms/linkedList/21.mergeTwoSortedLists_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// run: go test -v base.go 21.*

algorithms/linkedList/234.isPalindrome.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package linkedList
33
import (
44
"fmt"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
func isPalindrome(head *ListNode) bool {

algorithms/linkedList/234.isPalindrome_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package linkedList
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
// run: go test -v base.go 234.*

algorithms/linkedList/237.deleteNode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
type (

algorithms/linkedList/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package linkedList
22

33
import (
4-
"gopl.io/interview2020/Leetcode/algorithms/kit"
4+
"Leetcode/algorithms/kit"
55
)
66

77
type ListNode = kit.ListNode

algorithms/myarray/11.maxArea_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package myarray
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
func Test_maxArea(t *testing.T) {

algorithms/myarray/118.generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// go test -v 118.*

algorithms/myarray/1213.arraysIntersection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v 1213.*

algorithms/myarray/15.threeSum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v 15.*

algorithms/myarray/33.search_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package myarray
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
type entry33input struct {

algorithms/myarray/34.searchRange_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
type entry34input struct {

algorithms/myarray/442.findDuplicates_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v 442.*

algorithms/myarray/509.fibnacci_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v 509.*

algorithms/myarray/53.maxSubArray_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/stretchr/testify/assert"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// run: go test -v 53.*

algorithms/myheap/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package myheap
22

33
import (
4-
"gopl.io/interview2020/Leetcode/algorithms/kit"
4+
"Leetcode/algorithms/kit"
55
)
66

77
type MinHeap = kit.MinHeap

algorithms/myqueue/933.RecentCounter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package myqueue
22

33
import (
4-
"gopl.io/interview2020/Leetcode/algorithms/kit"
4+
"Leetcode/algorithms/kit"
55
)
66

77
// 题目:最近的请求次数 https://leetcode-cn.com/problems/number-of-recent-calls/

algorithms/mystack/1021.removeOuterParentheses.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mystack
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// removeOuterParentheses remove the outer parentheses of S
66
func removeOuterParentheses(S string) string {

algorithms/mystack/155.minStack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mystack
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// MinStack declare
66
type MinStack struct {

algorithms/mystack/173.BSTIterator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mystack
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// https://leetcode-cn.com/problems/binary-search-tree-iterator/
66
// 7

algorithms/mystack/173.BSTIterator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package mystack
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77

88
"github.com/stretchr/testify/assert"
99
)

algorithms/mystack/225.myStack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package mystack
33
import (
44
_ "fmt"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
// MyStack Declare

algorithms/mystack/232.myQueue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mystack
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// problem: https://leetcode-cn.com/problems/implement-queue-using-stacks/
66
// 使用栈实现队列的下列操作:

algorithms/mystack/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mystack
22

33
import (
4-
"gopl.io/interview2020/Leetcode/algorithms/kit"
4+
"Leetcode/algorithms/kit"
55
)
66

77
var NULL = kit.NULL

algorithms/mystring/20.isValid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mystring
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// isValid1 based on stack
66
func isValid1(s string) bool { // {{{

algorithms/mystring/32.longestValidParentheses.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"math"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// 此处默认s只包含 '(' 和 ')'

algorithms/mystring/71.simplifyPath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"path/filepath"
66
"strings"
77

8-
"gopl.io/interview2020/Leetcode/algorithms/kit"
8+
"Leetcode/algorithms/kit"
99
)
1010

1111
// 1. 用栈

algorithms/tree/101.isSymmetric_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package tree
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
// go test -v base.go 101.*

algorithms/tree/102.levelOrder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
_ "fmt"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// go test -v base.go 102.*

algorithms/tree/104.maxDepth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package tree
33
import (
44
"testing"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
// run: go test -v base.go 104.*

algorithms/tree/144.preorderTraversal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package tree
22

3-
import "gopl.io/interview2020/Leetcode/algorithms/kit"
3+
import "Leetcode/algorithms/kit"
44

55
// preorderTraversal 基于栈的前序遍历
66
// 前序遍历顺序:根->左->右,在遍历左、右子树时,仍然先访问根结点,然后遍历左子树,最后遍历右子树

algorithms/tree/144.preorderTraversal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
type entry144 struct {

algorithms/tree/145.postorderTraversal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package tree
33
import (
44
_ "fmt"
55

6-
"gopl.io/interview2020/Leetcode/algorithms/kit"
6+
"Leetcode/algorithms/kit"
77
)
88

99
// postorderTraversal 基于栈的后序遍历

algorithms/tree/145.postorderTraversal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
type entry145 struct {

algorithms/tree/226.invertTree_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"gopl.io/interview2020/Leetcode/algorithms/kit"
7+
"Leetcode/algorithms/kit"
88
)
99

1010
// run: go test -v base.go 226.*

0 commit comments

Comments
 (0)