File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Leetcode/1046.Last-Stone-Weight Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change
1
+ package laststoneweight
1
2
2
- // 時間複雜 O(), 空間複雜 O()
3
+ // 時間複雜 O(), 空間複雜 O()
4
+ func LastStoneWeight (stones []int ) int {
5
+
6
+ }
Original file line number Diff line number Diff line change 1
- package
1
+ package laststoneweight
2
2
3
3
import "testing"
4
4
5
5
var tests = []struct {
6
- arg1 string
6
+ arg1 [] int
7
7
want int
8
8
}{
9
9
{
10
- "bbbab" ,
11
- 4 ,
10
+ [] int { 2 , 7 , 4 , 1 , 8 , 1 } ,
11
+ 1 ,
12
12
},
13
13
}
14
14
15
- func TestLongestPalindromeSubseq (t * testing.T ) {
15
+ func TestLastStoneWeight (t * testing.T ) {
16
16
for _ , tt := range tests {
17
17
// if got := ReverseList(tt.arg1); !reflect.DeepEqual(got, tt.want) {
18
- if got := LongestPalindromeSubseq (tt .arg1 ); got != tt .want {
18
+ if got := LastStoneWeight (tt .arg1 ); got != tt .want {
19
19
t .Errorf ("got = %v, want = %v" , got , tt .want )
20
20
}
21
21
}
22
22
}
23
23
24
- func BenchmarkLongestPalindromeSubseq (b * testing.B ) {
24
+ func BenchmarkLastStoneWeight (b * testing.B ) {
25
25
b .ResetTimer ()
26
26
for i := 0 ; i < b .N ; i ++ {
27
- LongestPalindromeSubseq (tests [0 ].arg1 )
27
+ LastStoneWeight (tests [0 ].arg1 )
28
28
}
29
29
}
30
30
31
31
/*
32
- go test -benchmem -run=none LeetcodeGolang/Leetcode/0354.Russian-Doll-Envelopes -bench=.
32
+ go test -benchmem -run=none LeetcodeGolang/Leetcode/1046.Last-Stone-Weight -bench=.
33
33
34
34
*/
You can’t perform that action at this time.
0 commit comments