[HAI] open lesson maxSum
sliding window fixed size
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { maxSum } from "./maxSum.ts";
|
||||
|
||||
describe("maxSum", () => {
|
||||
|
||||
it("[3, 2, 5, 9, 4 ,1] k=3 answer 18", () => {
|
||||
const NUMS = [3, 2, 5, 9, 4, 1];
|
||||
expect(maxSum(NUMS, 3)).toBe(18);
|
||||
});
|
||||
|
||||
it("[0, 1, 2, 8, 1 ,11, 10, 0, 0 ,5] k=4 answer 18", () => {
|
||||
const NUMS = [0, 1, 2, 8, 1, 11, 10, 0, 0, 5];
|
||||
expect(maxSum(NUMS, 4)).toBe(30);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user