deno.land / x / masx200_leetcode_test@10.6.5 / sliding-window-maximum / test.ts
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import { assertEquals } from "https://deno.land/std@0.157.0/testing/asserts.ts";
import maxSlidingWindow from "./index.ts";
Deno.test("sliding-window-maximum", () => { const inputs = [ [[1, 3, -1, -3, 5, 3, 6, 7], 3], [[1], 1], [[6], 1],
[ [ 1, 3, -1, -31, 3, -1, -3, 5, 3, 6, 7, 3, 3, 5, 5, 6, 71, 3, -1, -3, 5, 3, 6, 7, 3, 3, 5, 5, 6, 7, 5, 3, 6, 7, 3, 3, 5, 5, 6, 71, 3, -1, -3, 5, 3, 6, 7, 3, 3, 5, 5, 6, 7, ], 16, ], [[], 7], [[2], 0], ] as Array<Parameters<typeof maxSlidingWindow>>; const outputs = [ [3, 3, 5, 5, 6, 7], [1], [6],
[ 7, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 7, 7, 7, 7, 7, 7, 7, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, ], [], [], ]; assertEquals( inputs.map(([input, k]) => maxSlidingWindow(input, k)), outputs, );});
Version Info