Skip to content

Commit 72b6986

Browse files
aQuaaQua
aQua
authored and
aQua
committed
643 accepted
1 parent 2244cee commit 72b6986

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Algorithms/0643.maximum-average-subarray-i/maximum-average-subarray-i.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package Problem0643
22

33
func findMaxAverage(nums []int, k int) float64 {
4-
max := 0
4+
max := -10001 * k
55

66
for i := 0; i+k-1 < len(nums); i++ {
77
temp := 0

Algorithms/0643.maximum-average-subarray-i/maximum-average-subarray-i_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ func Test_Problem0643(t *testing.T) {
3030

3131
qs := []question{
3232

33+
question{
34+
para{[]int{-1}, 1},
35+
ans{-1},
36+
},
37+
3338
question{
3439
para{[]int{1, 12, -5, -6, 50, 3}, 4},
3540
ans{12.75},

0 commit comments

Comments
 (0)