Skip to content

Commit b072bb9

Browse files
committed
💖 测试更新Readme
1 parent 7bb77d0 commit b072bb9

File tree

10 files changed

+279
-30
lines changed

10 files changed

+279
-30
lines changed

README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@ LeetCode of algorithms with golang solution(updating:smiley:).
1111
| # | Title | Solution | Acceptance | Difficulty | Tag |
1212
| :--- | :--------------- | :------------- | :------------- | :------------- | :------------- |
1313
| 1 | [Two Sum][0001-url] | [Golang][0001-golang] | 39.0% |:purple_heart: |:eyes:|
14-
| 2 | [Add Two Numbers][0002-url] | [Golang][0002-golang] | 29.2% |:purple_heart: |:star:|
15-
| 3 | [Longest Substring Without Repeating Characters][0003-url] | [Golang][0003-golang] | 25.1% |:purple_heart: |:eyes:|
16-
| 4 | [Median of Two Sorted Arrays ][0004-url] | [Golang][0004-golang] | 24.1% |:purple_heart: |:eyes: |
17-
| 5 | [Longest Palindromic Substring ][0005-url] | [Golang][0005-golang] | 25.6% |:purple_heart: |:eyes: |
18-
| 6 | [ZigZag Conversion][0006-url] | [Golang][0006-golang] |28.8% |:purple_heart: |:eyes: |
14+
| 2 | [Add Two Numbers][0002-url] | [Golang][0002-golang] | 29.2% |:purple_heart: :purple_heart: |:star:|
15+
| 3 | [Longest Substring Without Repeating Characters][0003-url] | [Golang][0003-golang] | 25.1% |:purple_heart: :purple_heart:|:eyes:|
16+
| 4 | [Median of Two Sorted Arrays ][0004-url] | [Golang][0004-golang] | 24.1% |:purple_heart: :purple_heart::purple_heart: |:eyes: |
17+
| 5 | [Longest Palindromic Substring ][0005-url] | [Golang][0005-golang] | 25.6% |:purple_heart: :purple_heart: |:eyes: |
18+
| 6 | [ZigZag Conversion][0006-url] | [Golang][0006-golang] |28.8% |:purple_heart::purple_heart: |:eyes: |
1919
| 7 | [Reverse Integer][0007-url] | [Golang][0007-golang] | 24.5% |:purple_heart: |:eyes: |
20-
| 8 | [String to Integer (atoi)][0008-url] | [Golang][0008-golang] | 14.2% |:purple_heart: |:eyes: |
20+
| 8 | [String to Integer (atoi)][0008-url] | [Golang][0008-golang] | 14.2% |:purple_heart: :purple_heart: |:eyes: |
2121
| 9 | [Palindrome Number][0009-url] | [Golang][0009-golang] | 38.9% |:purple_heart: |:eyes: |
22-
| 10 | [Regular Expression Matching][0010-url] | [Golang][nil] | 24.4% |:purple_heart: | :eyes:|
23-
| 11 | [Container With Most Water][0011-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
24-
| 12 | [Integer to Roman][0012-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
25-
| 13 | [Roman to Integer][0013-url] | [Golang][nil] | 24.4% |:purple_heart: | :eyes:|
26-
| 14 | [Longest Common Prefix][0014-url] | [Golang][nil] | 24.4% |:purple_heart: | :eyes:|
27-
| 15 | [3Sum][0015-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
28-
| 16 | [3Sum Closest][0016-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
29-
| 17 | [Letter Combinations of a Phone Number][0017-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
30-
| 18 | [4Sum][0018-url] | [Golang][nil] | 24.4% |:purple_heart: |:eyes: |
31-
| 19 | [Remove Nth Node From End of List][0018-url] | [Golang][nil] | 24.4% |:purple_heart: | :eyes:|
32-
| 20 | [Valid Parentheses ][0020-url] | [Golang][nil] | 24.4% |:trollface: | :eyes:|
22+
| 10 | [Regular Expression Matching][0010-url] | [Golang][0010-golang] | 24.4% |:purple_heart::purple_heart::purple_heart: | :eyes:|
23+
| 11 | [Container With Most Water][0011-url] | [Golang][0011-golang] | 39.3% |:purple_heart: :purple_heart: |:eyes: |
24+
| 12 | [Integer to Roman][0012-url] | [Golang][0012-golang] | 48.0% |:purple_heart::purple_heart: |:eyes: |
25+
| 13 | [Roman to Integer][0013-url] | [Golang][0013-golang] | 49.7% |:purple_heart: | :eyes:|
26+
| 14 | [Longest Common Prefix][0014-url] | [Golang][0014-golang] | 32.0% |:purple_heart: | :eyes:|
27+
| 15 | [3Sum][0015-url] | [Golang][0015-golang] | 22.2% |:purple_heart: :purple_heart: |:eyes: |
28+
| 16 | [3Sum Closest][0016-url] | [Golang][0016-golang] | 32.8% |:purple_heart: :purple_heart:|:eyes: |
29+
| 17 | [Letter Combinations of a Phone Number][0017-url] | [Golang][0017-golang] | 38.4% |:purple_heart: :purple_heart: |:eyes: |
30+
| 18 | [4Sum][0018-url] | [Golang][0018-golang] | 28.5% |:purple_heart::purple_heart: |:eyes: |
31+
| 19 | [Remove Nth Node From End of List][0018-url] | [Golang][0019-golang] | 33.6% |:purple_heart: :purple_heart: | :eyes:|
32+
| 20 | [Valid Parentheses ][0020-url] | [Golang][0020-golang] | 34.7% |:purple_heart: | :eyes:|
3333

3434

3535

3636
[src]: https://github.com/kylesliu/awesome-golang-leetcode
3737
[companies]: https://github.com/kylesliu/awesome-golang-leetcode/blob/master/Companies.md
3838

39-
[0001-url]: https://leetcode.com/problems/add-two-numbers
39+
[0001-url]: https://leetcode.com/problems/two-sum
4040
[0001-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
4141

42-
[0002-url]: https://leetcode.com/problems/longest-substring-without-repeating-characters
42+
[0002-url]: https://leetcode.com/problems/add-two-numbers
4343
[0002-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0002.Add-Two-Numbers
4444

4545
[0003-url]: https://leetcode.com/problems/longest-substring-without-repeating-characters
@@ -64,34 +64,34 @@ LeetCode of algorithms with golang solution(updating:smiley:).
6464
[0009-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0009.Palindrome-Number
6565

6666
[0010-url]: https://leetcode.com/problems/regular-expression-matching
67-
[0010-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
67+
[0010-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0010.Regular-Expression-Matching
6868

6969
[0011-url]: https://leetcode.com/problems/container-with-most-water
70-
[0011-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
70+
[0011-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0011.Container-With-Most-Water
7171

7272
[0012-url]: https://leetcode.com/problems/integer-to-roman
73-
[0012-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
73+
[0012-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0012.Integer-to-Roman
7474

7575
[0013-url]: https://leetcode.com/problems/roman-to-integer
76-
[0013-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
76+
[0013-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0013.Roman-to-Integer
7777

7878
[0014-url]: https://leetcode.com/problems/longest-common-prefix
79-
[0014-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
79+
[0014-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0014.Longest-Common-Prefix
8080

8181
[0015-url]: https://leetcode.com/problems/3sum
82-
[0015-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
82+
[0015-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0015.3Sum
8383

8484
[0016-url]: https://leetcode.com/problems/3sum-closest
85-
[0016-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
85+
[0016-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0016.3Sum-Closest
8686

8787
[0017-url]: https://leetcode.com/problems/letter-combinations-of-a-phone-number
88-
[0017-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
88+
[0017-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0017.Letter-Combinations-of-a-Phone-Number
8989

9090
[0018-url]: https://leetcode.com/problems/4sum
91-
[0018-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
91+
[0018-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0018.4Sum
9292

9393
[0019-url]: https://leetcode.com/problems/remove-nth-node-from-end-of-list
94-
[0019-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
94+
[0019-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0019.Remove-Nth-Node-From-End-of-List
9595

9696
[0020-url]: https://leetcode.com/problems/valid-parentheses
97-
[0020-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0001.Two-Sum
97+
[0020-golang]: https://github.com/kylesliu/awesome-golang-leetcode/tree/master/src/0020.Valid-Parentheses
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# [4. Median of Two Sorted Arrays][title]
2+
3+
## Description
4+
5+
Given two binary strings, return their sum (also a binary string).
6+
7+
The input strings are both **non-empty** and contains only characters `1` or `0`.
8+
9+
**Example 1:**
10+
11+
```
12+
Input: a = "11", b = "1"
13+
Output: "100"
14+
```
15+
16+
**Example 2:**
17+
18+
```
19+
Input: a = "1010", b = "1011"
20+
Output: "10101"
21+
```
22+
23+
**Tags:** Math, String
24+
25+
## 题意
26+
>给你两个二进制串,求其和的二进制串。
27+
28+
## 题解
29+
30+
### 思路1
31+
> 按照小学算数那么来做,用 `carry` 表示进位,从后往前算,依次往前,每算出一位就插入到最前面即可,直到把两个二进制串都遍历完即可。
32+
33+
```go
34+
35+
```
36+
37+
### 思路2
38+
> 思路2
39+
```go
40+
41+
```
42+
43+
## 结语
44+
45+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-leetcode][me]
46+
47+
[title]: https://leetcode.com/problems/median-of-two-sorted-arrays/description/
48+
[me]: https://github.com/kylesliu/awesome-golang-leetcode
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Solution
2+
3+
func Solution(x bool) bool {
4+
return x
5+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func TestSolution(t *testing.T) {
9+
// 测试用例
10+
cases := []struct {
11+
name string
12+
inputs bool
13+
expect bool
14+
}{
15+
{"1 test 1", true, true},
16+
{"2 test 2", true, true},
17+
{"3 test 3", false, true},
18+
}
19+
20+
// 开始测试
21+
for _, c := range cases {
22+
t.Run(c.name, func(t *testing.T) {
23+
ret := Solution(c.inputs)
24+
if !reflect.DeepEqual(ret, c.expect) {
25+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
26+
c.expect, ret, c.inputs)
27+
}
28+
})
29+
}
30+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# [5. Longest Palindromic Substring][title]
2+
3+
## Description
4+
5+
Given two binary strings, return their sum (also a binary string).
6+
7+
The input strings are both **non-empty** and contains only characters `1` or `0`.
8+
9+
**Example 1:**
10+
11+
```
12+
Input: a = "11", b = "1"
13+
Output: "100"
14+
```
15+
16+
**Example 2:**
17+
18+
```
19+
Input: a = "1010", b = "1011"
20+
Output: "10101"
21+
```
22+
23+
**Tags:** Math, String
24+
25+
## 题意
26+
>给你两个二进制串,求其和的二进制串。
27+
28+
## 题解
29+
30+
### 思路1
31+
> 按照小学算数那么来做,用 `carry` 表示进位,从后往前算,依次往前,每算出一位就插入到最前面即可,直到把两个二进制串都遍历完即可。
32+
33+
```go
34+
35+
```
36+
37+
### 思路2
38+
> 思路2
39+
```go
40+
41+
```
42+
43+
## 结语
44+
45+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-leetcode][me]
46+
47+
[title]: https://leetcode.com/problems/longest-palindromic-substring/description/
48+
[me]: https://github.com/kylesliu/awesome-golang-leetcode
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Solution
2+
3+
func Solution(x bool) bool {
4+
return x
5+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func TestSolution(t *testing.T) {
9+
// 测试用例
10+
cases := []struct {
11+
name string
12+
inputs bool
13+
expect bool
14+
}{
15+
{"1 test 1", true, true},
16+
{"2 test 2", true, true},
17+
{"3 test 3", false, true},
18+
}
19+
20+
// 开始测试
21+
for _, c := range cases {
22+
t.Run(c.name, func(t *testing.T) {
23+
ret := Solution(c.inputs)
24+
if !reflect.DeepEqual(ret, c.expect) {
25+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
26+
c.expect, ret, c.inputs)
27+
}
28+
})
29+
}
30+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# [10. Regular Expression Matching][title]
2+
3+
## Description
4+
5+
Given two binary strings, return their sum (also a binary string).
6+
7+
The input strings are both **non-empty** and contains only characters `1` or `0`.
8+
9+
**Example 1:**
10+
11+
```
12+
Input: a = "11", b = "1"
13+
Output: "100"
14+
```
15+
16+
**Example 2:**
17+
18+
```
19+
Input: a = "1010", b = "1011"
20+
Output: "10101"
21+
```
22+
23+
**Tags:** Math, String
24+
25+
## 题意
26+
>给你两个二进制串,求其和的二进制串。
27+
28+
## 题解
29+
30+
### 思路1
31+
> 按照小学算数那么来做,用 `carry` 表示进位,从后往前算,依次往前,每算出一位就插入到最前面即可,直到把两个二进制串都遍历完即可。
32+
33+
```go
34+
35+
```
36+
37+
### 思路2
38+
> 思路2
39+
```go
40+
41+
```
42+
43+
## 结语
44+
45+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-leetcode][me]
46+
47+
[title]: https://leetcode.com/problems/regular-expression-matching/description/
48+
[me]: https://github.com/kylesliu/awesome-golang-leetcode
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Solution
2+
3+
func Solution(x bool) bool {
4+
return x
5+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func TestSolution(t *testing.T) {
9+
// 测试用例
10+
cases := []struct {
11+
name string
12+
inputs bool
13+
expect bool
14+
}{
15+
{"1 test 1", true, true},
16+
{"2 test 2", true, true},
17+
{"3 test 3", false, true},
18+
}
19+
20+
// 开始测试
21+
for _, c := range cases {
22+
t.Run(c.name, func(t *testing.T) {
23+
ret := Solution(c.inputs)
24+
if !reflect.DeepEqual(ret, c.expect) {
25+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
26+
c.expect, ret, c.inputs)
27+
}
28+
})
29+
}
30+
}

0 commit comments

Comments
 (0)