-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from 0xff-dev/add-3001-3100
add 3001-3100 problems. add solution and test-cases for problem 3085
- Loading branch information
Showing
219 changed files
with
5,609 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
leetcode/3001-3100/3001.Minimum-Moves-to-Capture-The-Queen/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [3001.Minimum Moves to Capture The Queen][title] | ||
|
||
> [!WARNING|style:flat] | ||
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm) | ||
## Description | ||
|
||
**Example 1:** | ||
|
||
``` | ||
Input: a = "11", b = "1" | ||
Output: "100" | ||
``` | ||
|
||
## 题意 | ||
> ... | ||
## 题解 | ||
|
||
### 思路1 | ||
> ... | ||
Minimum Moves to Capture The Queen | ||
```go | ||
``` | ||
|
||
|
||
## 结语 | ||
|
||
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me] | ||
|
||
[title]: https://leetcode.com/problems/minimum-moves-to-capture-the-queen/ | ||
[me]: https://github.com/kylesliu/awesome-golang-algorithm |
5 changes: 5 additions & 0 deletions
5
leetcode/3001-3100/3001.Minimum-Moves-to-Capture-The-Queen/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
} |
39 changes: 39 additions & 0 deletions
39
leetcode/3001-3100/3001.Minimum-Moves-to-Capture-The-Queen/Solution_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Solution | ||
|
||
import ( | ||
"reflect" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestSolution(t *testing.T) { | ||
// 测试用例 | ||
cases := []struct { | ||
name string | ||
inputs bool | ||
expect bool | ||
}{ | ||
{"TestCase", true, true}, | ||
{"TestCase", true, true}, | ||
{"TestCase", false, false}, | ||
} | ||
|
||
// 开始测试 | ||
for i, c := range cases { | ||
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) { | ||
got := Solution(c.inputs) | ||
if !reflect.DeepEqual(got, c.expect) { | ||
t.Fatalf("expected: %v, but got: %v, with inputs: %v", | ||
c.expect, got, c.inputs) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
// 压力测试 | ||
func BenchmarkSolution(b *testing.B) { | ||
} | ||
|
||
// 使用案列 | ||
func ExampleSolution() { | ||
} |
32 changes: 32 additions & 0 deletions
32
leetcode/3001-3100/3002.Maximum-Size-of-a-Set-After-Removals/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [3002.Maximum Size of a Set After Removals][title] | ||
|
||
> [!WARNING|style:flat] | ||
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm) | ||
## Description | ||
|
||
**Example 1:** | ||
|
||
``` | ||
Input: a = "11", b = "1" | ||
Output: "100" | ||
``` | ||
|
||
## 题意 | ||
> ... | ||
## 题解 | ||
|
||
### 思路1 | ||
> ... | ||
Maximum Size of a Set After Removals | ||
```go | ||
``` | ||
|
||
|
||
## 结语 | ||
|
||
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me] | ||
|
||
[title]: https://leetcode.com/problems/maximum-size-of-a-set-after-removals/ | ||
[me]: https://github.com/kylesliu/awesome-golang-algorithm |
5 changes: 5 additions & 0 deletions
5
leetcode/3001-3100/3002.Maximum-Size-of-a-Set-After-Removals/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
} |
39 changes: 39 additions & 0 deletions
39
leetcode/3001-3100/3002.Maximum-Size-of-a-Set-After-Removals/Solution_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Solution | ||
|
||
import ( | ||
"reflect" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestSolution(t *testing.T) { | ||
// 测试用例 | ||
cases := []struct { | ||
name string | ||
inputs bool | ||
expect bool | ||
}{ | ||
{"TestCase", true, true}, | ||
{"TestCase", true, true}, | ||
{"TestCase", false, false}, | ||
} | ||
|
||
// 开始测试 | ||
for i, c := range cases { | ||
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) { | ||
got := Solution(c.inputs) | ||
if !reflect.DeepEqual(got, c.expect) { | ||
t.Fatalf("expected: %v, but got: %v, with inputs: %v", | ||
c.expect, got, c.inputs) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
// 压力测试 | ||
func BenchmarkSolution(b *testing.B) { | ||
} | ||
|
||
// 使用案列 | ||
func ExampleSolution() { | ||
} |
32 changes: 32 additions & 0 deletions
32
...ode/3001-3100/3003.Maximize-the-Number-of-Partitions-After-Operations/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [3003.Maximize the Number of Partitions After Operations][title] | ||
|
||
> [!WARNING|style:flat] | ||
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm) | ||
## Description | ||
|
||
**Example 1:** | ||
|
||
``` | ||
Input: a = "11", b = "1" | ||
Output: "100" | ||
``` | ||
|
||
## 题意 | ||
> ... | ||
## 题解 | ||
|
||
### 思路1 | ||
> ... | ||
Maximize the Number of Partitions After Operations | ||
```go | ||
``` | ||
|
||
|
||
## 结语 | ||
|
||
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me] | ||
|
||
[title]: https://leetcode.com/problems/maximize-the-number-of-partitions-after-operations/ | ||
[me]: https://github.com/kylesliu/awesome-golang-algorithm |
5 changes: 5 additions & 0 deletions
5
leetcode/3001-3100/3003.Maximize-the-Number-of-Partitions-After-Operations/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
} |
39 changes: 39 additions & 0 deletions
39
leetcode/3001-3100/3003.Maximize-the-Number-of-Partitions-After-Operations/Solution_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Solution | ||
|
||
import ( | ||
"reflect" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestSolution(t *testing.T) { | ||
// 测试用例 | ||
cases := []struct { | ||
name string | ||
inputs bool | ||
expect bool | ||
}{ | ||
{"TestCase", true, true}, | ||
{"TestCase", true, true}, | ||
{"TestCase", false, false}, | ||
} | ||
|
||
// 开始测试 | ||
for i, c := range cases { | ||
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) { | ||
got := Solution(c.inputs) | ||
if !reflect.DeepEqual(got, c.expect) { | ||
t.Fatalf("expected: %v, but got: %v, with inputs: %v", | ||
c.expect, got, c.inputs) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
// 压力测试 | ||
func BenchmarkSolution(b *testing.B) { | ||
} | ||
|
||
// 使用案列 | ||
func ExampleSolution() { | ||
} |
32 changes: 32 additions & 0 deletions
32
leetcode/3001-3100/3005.Count-Elements-With-Maximum-Frequency/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [3005.Count Elements With Maximum Frequency][title] | ||
|
||
> [!WARNING|style:flat] | ||
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm) | ||
## Description | ||
|
||
**Example 1:** | ||
|
||
``` | ||
Input: a = "11", b = "1" | ||
Output: "100" | ||
``` | ||
|
||
## 题意 | ||
> ... | ||
## 题解 | ||
|
||
### 思路1 | ||
> ... | ||
Count Elements With Maximum Frequency | ||
```go | ||
``` | ||
|
||
|
||
## 结语 | ||
|
||
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me] | ||
|
||
[title]: https://leetcode.com/problems/count-elements-with-maximum-frequency/ | ||
[me]: https://github.com/kylesliu/awesome-golang-algorithm |
5 changes: 5 additions & 0 deletions
5
leetcode/3001-3100/3005.Count-Elements-With-Maximum-Frequency/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
} |
39 changes: 39 additions & 0 deletions
39
leetcode/3001-3100/3005.Count-Elements-With-Maximum-Frequency/Solution_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Solution | ||
|
||
import ( | ||
"reflect" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestSolution(t *testing.T) { | ||
// 测试用例 | ||
cases := []struct { | ||
name string | ||
inputs bool | ||
expect bool | ||
}{ | ||
{"TestCase", true, true}, | ||
{"TestCase", true, true}, | ||
{"TestCase", false, false}, | ||
} | ||
|
||
// 开始测试 | ||
for i, c := range cases { | ||
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) { | ||
got := Solution(c.inputs) | ||
if !reflect.DeepEqual(got, c.expect) { | ||
t.Fatalf("expected: %v, but got: %v, with inputs: %v", | ||
c.expect, got, c.inputs) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
// 压力测试 | ||
func BenchmarkSolution(b *testing.B) { | ||
} | ||
|
||
// 使用案列 | ||
func ExampleSolution() { | ||
} |
32 changes: 32 additions & 0 deletions
32
leetcode/3001-3100/3006.Find-Beautiful-Indices-in-the-Given-Array-I/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [3006.Find Beautiful Indices in the Given Array I][title] | ||
|
||
> [!WARNING|style:flat] | ||
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm) | ||
## Description | ||
|
||
**Example 1:** | ||
|
||
``` | ||
Input: a = "11", b = "1" | ||
Output: "100" | ||
``` | ||
|
||
## 题意 | ||
> ... | ||
## 题解 | ||
|
||
### 思路1 | ||
> ... | ||
Find Beautiful Indices in the Given Array I | ||
```go | ||
``` | ||
|
||
|
||
## 结语 | ||
|
||
如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-golang-algorithm][me] | ||
|
||
[title]: https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/ | ||
[me]: https://github.com/kylesliu/awesome-golang-algorithm |
5 changes: 5 additions & 0 deletions
5
leetcode/3001-3100/3006.Find-Beautiful-Indices-in-the-Given-Array-I/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
} |
39 changes: 39 additions & 0 deletions
39
leetcode/3001-3100/3006.Find-Beautiful-Indices-in-the-Given-Array-I/Solution_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Solution | ||
|
||
import ( | ||
"reflect" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestSolution(t *testing.T) { | ||
// 测试用例 | ||
cases := []struct { | ||
name string | ||
inputs bool | ||
expect bool | ||
}{ | ||
{"TestCase", true, true}, | ||
{"TestCase", true, true}, | ||
{"TestCase", false, false}, | ||
} | ||
|
||
// 开始测试 | ||
for i, c := range cases { | ||
t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) { | ||
got := Solution(c.inputs) | ||
if !reflect.DeepEqual(got, c.expect) { | ||
t.Fatalf("expected: %v, but got: %v, with inputs: %v", | ||
c.expect, got, c.inputs) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
// 压力测试 | ||
func BenchmarkSolution(b *testing.B) { | ||
} | ||
|
||
// 使用案列 | ||
func ExampleSolution() { | ||
} |
Oops, something went wrong.