Skip to content

Commit 700dbc8

Browse files
committed
测试
1 parent 05abf33 commit 700dbc8

File tree

3 files changed

+72
-4
lines changed

3 files changed

+72
-4
lines changed

combinations/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ function combine(n: number, k: number): number[][] {
3232
});
3333
return ans;
3434
}
35-
const dfs = (
35+
function dfs(
3636
cur: number,
3737
n: number,
3838
k: number,
3939
temp: number[],
4040
output: (nums: number[]) => void,
41-
) => {
41+
) {
4242
if (temp.length > k) {
4343
return;
4444
}
@@ -57,5 +57,5 @@ const dfs = (
5757
if (temp.length + 1 <= k) {
5858
dfs(cur + 1, n, k, [...temp, cur], output);
5959
}
60-
};
60+
}
6161
export default combine;

copy-list-with-random-pointer/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default function copyRandomList(head: Node | null): Node | null {
1313
cloned.next = copyRandomList(head.next);
1414
cloned.random = copyRandomList(head.random);
1515
return cloned;
16-
// cachedNode.set(head, {val: head.val}), Object.assign(cachedNode.get(head), {next: copyRandomList(head.next, cachedNode), random: copyRandomList(head.random, cachedNode)})
1716
}
1817
const result = cachedNode.get(head);
1918
return result ? result : null;
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { runScript } from "leetcode-class";
2+
import { assertEquals } from "../deps.ts";
3+
import CustomStack from "./index.ts";
4+
5+
Deno.test("design-a-stack-with-increment-operation", () => {
6+
const e: any[][] = [
7+
[[
8+
"CustomStack",
9+
"push",
10+
"push",
11+
"pop",
12+
"push",
13+
"push",
14+
"push",
15+
"increment",
16+
"increment",
17+
"pop",
18+
"pop",
19+
"pop",
20+
"pop",
21+
], [
22+
[3],
23+
[1],
24+
[2],
25+
[],
26+
[2],
27+
[3],
28+
[4],
29+
[5, 100],
30+
[2, 100],
31+
[],
32+
[],
33+
[],
34+
[],
35+
]],
36+
[[
37+
"CustomStack",
38+
"push",
39+
"pop",
40+
"increment",
41+
"pop",
42+
"increment",
43+
"push",
44+
"pop",
45+
"push",
46+
"increment",
47+
"increment",
48+
"increment",
49+
], [[2], [34], [], [8, 100], [], [9, 91], [63], [], [84], [10, 93], [
50+
6,
51+
45,
52+
], [10, 4]]],
53+
];
54+
assertEquals(e.map((a) => runScript(a[0], a[1], [CustomStack])), [[
55+
null,
56+
null,
57+
null,
58+
2,
59+
null,
60+
null,
61+
null,
62+
null,
63+
null,
64+
103,
65+
202,
66+
201,
67+
-1,
68+
], [null, null, 34, null, -1, null, null, 63, null, null, null, null]]);
69+
});

0 commit comments

Comments
 (0)