Skip to content

Commit aaa4709

Browse files
committed
feat: 1046. Last Stone Weight Unit Test
1 parent 432251e commit aaa4709

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
package laststoneweight
12

2-
// 時間複雜 O(), 空間複雜 O()
3+
// 時間複雜 O(), 空間複雜 O()
4+
func LastStoneWeight(stones []int) int {
5+
6+
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
package
1+
package laststoneweight
22

33
import "testing"
44

55
var tests = []struct {
6-
arg1 string
6+
arg1 []int
77
want int
88
}{
99
{
10-
"bbbab",
11-
4,
10+
[]int{2, 7, 4, 1, 8, 1},
11+
1,
1212
},
1313
}
1414

15-
func TestLongestPalindromeSubseq(t *testing.T) {
15+
func TestLastStoneWeight(t *testing.T) {
1616
for _, tt := range tests {
1717
// 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 {
1919
t.Errorf("got = %v, want = %v", got, tt.want)
2020
}
2121
}
2222
}
2323

24-
func BenchmarkLongestPalindromeSubseq(b *testing.B) {
24+
func BenchmarkLastStoneWeight(b *testing.B) {
2525
b.ResetTimer()
2626
for i := 0; i < b.N; i++ {
27-
LongestPalindromeSubseq(tests[0].arg1)
27+
LastStoneWeight(tests[0].arg1)
2828
}
2929
}
3030

3131
/*
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=.
3333
3434
*/

0 commit comments

Comments
 (0)