deno.land / x / masx200_leetcode_test@10.6.5 / remove-duplicates-from-sorted-list / test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { assertEquals } from "../deps.ts";import { ArrayToListNode } from "../reverse-linked-list/ArrayToListNode.ts";import { ListNodeToArray } from "../reverse-linked-list/ListNodeToArray.ts";import removeDuplicates from "./index.ts";
Deno.test("remove-duplicates-from-sorted-list", () => { const examples: { input: number[]; output: number[] }[] = [ { input: [1, 1, 2], output: [1, 2] }, { input: [0, 0, 1, 1, 1, 2, 2, 3, 3, 4], output: [0, 1, 2, 3, 4] }, { input: [1, 1, 2, 3, 3], output: [1, 2, 3] }, { input: Array.from({ length: 40000 }).map((_i, v) => Math.floor(v / 2) ), output: Array.from({ length: 20000 }).map((_i, v) => v), }, ]; examples.forEach(({ input, output }) => { assertEquals( ListNodeToArray(removeDuplicates(ArrayToListNode(input))), output, ); });});
masx200_leetcode_test

Version Info

Tagged at
a year ago