Skip to content

Commit d3d3a8d

Browse files
committed
add 3001-3100 problems. add solution and test-cases for problem 3085
1 parent 09a1dcb commit d3d3a8d

File tree

219 files changed

+5609
-0
lines changed

Some content is hidden

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

219 files changed

+5609
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [3001.Minimum Moves to Capture The Queen][title]
2+
3+
> [!WARNING|style:flat]
4+
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5+
6+
## Description
7+
8+
**Example 1:**
9+
10+
```
11+
Input: a = "11", b = "1"
12+
Output: "100"
13+
```
14+
15+
## 题意
16+
> ...
17+
18+
## 题解
19+
20+
### 思路1
21+
> ...
22+
Minimum Moves to Capture The Queen
23+
```go
24+
```
25+
26+
27+
## 结语
28+
29+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me]
30+
31+
[title]: https://leetcode.com/problems/minimum-moves-to-capture-the-queen/
32+
[me]: https://github.com/kylesliu/awesome-golang-algorithm
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"strconv"
6+
"testing"
7+
)
8+
9+
func TestSolution(t *testing.T) {
10+
// 测试用例
11+
cases := []struct {
12+
name string
13+
inputs bool
14+
expect bool
15+
}{
16+
{"TestCase", true, true},
17+
{"TestCase", true, true},
18+
{"TestCase", false, false},
19+
}
20+
21+
// 开始测试
22+
for i, c := range cases {
23+
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
24+
got := Solution(c.inputs)
25+
if !reflect.DeepEqual(got, c.expect) {
26+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
27+
c.expect, got, c.inputs)
28+
}
29+
})
30+
}
31+
}
32+
33+
// 压力测试
34+
func BenchmarkSolution(b *testing.B) {
35+
}
36+
37+
// 使用案列
38+
func ExampleSolution() {
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [3002.Maximum Size of a Set After Removals][title]
2+
3+
> [!WARNING|style:flat]
4+
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5+
6+
## Description
7+
8+
**Example 1:**
9+
10+
```
11+
Input: a = "11", b = "1"
12+
Output: "100"
13+
```
14+
15+
## 题意
16+
> ...
17+
18+
## 题解
19+
20+
### 思路1
21+
> ...
22+
Maximum Size of a Set After Removals
23+
```go
24+
```
25+
26+
27+
## 结语
28+
29+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me]
30+
31+
[title]: https://leetcode.com/problems/maximum-size-of-a-set-after-removals/
32+
[me]: https://github.com/kylesliu/awesome-golang-algorithm
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"strconv"
6+
"testing"
7+
)
8+
9+
func TestSolution(t *testing.T) {
10+
// 测试用例
11+
cases := []struct {
12+
name string
13+
inputs bool
14+
expect bool
15+
}{
16+
{"TestCase", true, true},
17+
{"TestCase", true, true},
18+
{"TestCase", false, false},
19+
}
20+
21+
// 开始测试
22+
for i, c := range cases {
23+
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
24+
got := Solution(c.inputs)
25+
if !reflect.DeepEqual(got, c.expect) {
26+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
27+
c.expect, got, c.inputs)
28+
}
29+
})
30+
}
31+
}
32+
33+
// 压力测试
34+
func BenchmarkSolution(b *testing.B) {
35+
}
36+
37+
// 使用案列
38+
func ExampleSolution() {
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [3003.Maximize the Number of Partitions After Operations][title]
2+
3+
> [!WARNING|style:flat]
4+
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5+
6+
## Description
7+
8+
**Example 1:**
9+
10+
```
11+
Input: a = "11", b = "1"
12+
Output: "100"
13+
```
14+
15+
## 题意
16+
> ...
17+
18+
## 题解
19+
20+
### 思路1
21+
> ...
22+
Maximize the Number of Partitions After Operations
23+
```go
24+
```
25+
26+
27+
## 结语
28+
29+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me]
30+
31+
[title]: https://leetcode.com/problems/maximize-the-number-of-partitions-after-operations/
32+
[me]: https://github.com/kylesliu/awesome-golang-algorithm
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"strconv"
6+
"testing"
7+
)
8+
9+
func TestSolution(t *testing.T) {
10+
// 测试用例
11+
cases := []struct {
12+
name string
13+
inputs bool
14+
expect bool
15+
}{
16+
{"TestCase", true, true},
17+
{"TestCase", true, true},
18+
{"TestCase", false, false},
19+
}
20+
21+
// 开始测试
22+
for i, c := range cases {
23+
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
24+
got := Solution(c.inputs)
25+
if !reflect.DeepEqual(got, c.expect) {
26+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
27+
c.expect, got, c.inputs)
28+
}
29+
})
30+
}
31+
}
32+
33+
// 压力测试
34+
func BenchmarkSolution(b *testing.B) {
35+
}
36+
37+
// 使用案列
38+
func ExampleSolution() {
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [3005.Count Elements With Maximum Frequency][title]
2+
3+
> [!WARNING|style:flat]
4+
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5+
6+
## Description
7+
8+
**Example 1:**
9+
10+
```
11+
Input: a = "11", b = "1"
12+
Output: "100"
13+
```
14+
15+
## 题意
16+
> ...
17+
18+
## 题解
19+
20+
### 思路1
21+
> ...
22+
Count Elements With Maximum Frequency
23+
```go
24+
```
25+
26+
27+
## 结语
28+
29+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me]
30+
31+
[title]: https://leetcode.com/problems/count-elements-with-maximum-frequency/
32+
[me]: https://github.com/kylesliu/awesome-golang-algorithm
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"strconv"
6+
"testing"
7+
)
8+
9+
func TestSolution(t *testing.T) {
10+
// 测试用例
11+
cases := []struct {
12+
name string
13+
inputs bool
14+
expect bool
15+
}{
16+
{"TestCase", true, true},
17+
{"TestCase", true, true},
18+
{"TestCase", false, false},
19+
}
20+
21+
// 开始测试
22+
for i, c := range cases {
23+
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
24+
got := Solution(c.inputs)
25+
if !reflect.DeepEqual(got, c.expect) {
26+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
27+
c.expect, got, c.inputs)
28+
}
29+
})
30+
}
31+
}
32+
33+
// 压力测试
34+
func BenchmarkSolution(b *testing.B) {
35+
}
36+
37+
// 使用案列
38+
func ExampleSolution() {
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [3006.Find Beautiful Indices in the Given Array I][title]
2+
3+
> [!WARNING|style:flat]
4+
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5+
6+
## Description
7+
8+
**Example 1:**
9+
10+
```
11+
Input: a = "11", b = "1"
12+
Output: "100"
13+
```
14+
15+
## 题意
16+
> ...
17+
18+
## 题解
19+
20+
### 思路1
21+
> ...
22+
Find Beautiful Indices in the Given Array I
23+
```go
24+
```
25+
26+
27+
## 结语
28+
29+
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me]
30+
31+
[title]: https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/
32+
[me]: https://github.com/kylesliu/awesome-golang-algorithm
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package Solution
2+
3+
import (
4+
"reflect"
5+
"strconv"
6+
"testing"
7+
)
8+
9+
func TestSolution(t *testing.T) {
10+
// 测试用例
11+
cases := []struct {
12+
name string
13+
inputs bool
14+
expect bool
15+
}{
16+
{"TestCase", true, true},
17+
{"TestCase", true, true},
18+
{"TestCase", false, false},
19+
}
20+
21+
// 开始测试
22+
for i, c := range cases {
23+
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
24+
got := Solution(c.inputs)
25+
if !reflect.DeepEqual(got, c.expect) {
26+
t.Fatalf("expected: %v, but got: %v, with inputs: %v",
27+
c.expect, got, c.inputs)
28+
}
29+
})
30+
}
31+
}
32+
33+
// 压力测试
34+
func BenchmarkSolution(b *testing.B) {
35+
}
36+
37+
// 使用案列
38+
func ExampleSolution() {
39+
}

0 commit comments

Comments
 (0)