Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 15fa572

Browse files
author
openset
committed
Add: Stone Game
1 parent c64c7a7 commit 15fa572

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

‎internal/leetcode/problems_status.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ var problemStatus = map[int]bool{
170170
849: true,
171171
859: true,
172172
867: true,
173+
877: true,
173174
888: true,
174175
893: true,
175176
896: true,

‎problems/stone-game/stone_game.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
package stone_game
1+
package problem_877
2+
3+
func stoneGame(piles []int) bool {
4+
return true
5+
}
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
package stone_game
1+
package problem_877
2+
3+
import "testing"
4+
5+
type caseType struct {
6+
input []int
7+
expected bool
8+
}
9+
10+
func TestStoneGame(t *testing.T) {
11+
tests := [...]caseType{
12+
{
13+
input: []int{5, 3, 4, 5},
14+
expected: true,
15+
},
16+
{
17+
input: []int{2, 5, 7, 3},
18+
expected: true,
19+
},
20+
}
21+
for _, tc := range tests {
22+
output := stoneGame(tc.input)
23+
if output != tc.expected {
24+
t.Fatalf("input: %v, output: %v, expected: %v", tc.input, output, tc.expected)
25+
}
26+
}
27+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /