Skip to content

Commit 23da589

Browse files
committed
格式化
1 parent f8cbd1c commit 23da589

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

color-fill-lcci/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export {default}from"../flood-fill/index.ts"
1+
export { default } from "../flood-fill/index.ts";

longest-univalue-path/index.ts

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
import {TreeNode}from"../mod.ts"
1+
import { TreeNode } from "../mod.ts";
22
export default function longestUnivaluePath(root: TreeNode | null): number {
3-
4-
if(!root)return 0
5-
6-
3+
if (!root) return 0;
74

85
let res = 0;
9-
10-
dfs(root,s=>res=Math.max(res,s));
6+
7+
dfs(root, (s) => res = Math.max(res, s));
118
return res;
129
}
13-
function dfs(root: TreeNode | null,out:(s:number)=>void) {
14-
if (!root) {
15-
return 0;
16-
}
17-
const left = dfs(root.left,out)
18-
const right = dfs(root.right,out);
19-
let left1 = 0, right1 = 0;
20-
if (root.left && root.left.val === root.val) {
21-
left1 = left + 1;
22-
}
23-
if (root.right && root.right.val === root.val) {
24-
right1 = right + 1;
25-
}
26-
out( left1 + right1);
27-
return Math.max(left1, right1);
10+
function dfs(root: TreeNode | null, out: (s: number) => void) {
11+
if (!root) {
12+
return 0;
2813
}
14+
const left = dfs(root.left, out);
15+
const right = dfs(root.right, out);
16+
let left1 = 0, right1 = 0;
17+
if (root.left && root.left.val === root.val) {
18+
left1 = left + 1;
19+
}
20+
if (root.right && root.right.val === root.val) {
21+
right1 = right + 1;
22+
}
23+
out(left1 + right1);
24+
return Math.max(left1, right1);
25+
}

power-set-lcci/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default function subsets(nums: number[]): number[][] {
22
const ans: number[][] = [];
33

44
for (let i = 0; i < 2 ** nums.length; i++) {
5-
const temp : number[]= [];
5+
const temp: number[] = [];
66
for (
77
const [j, v] of (
88
Array.from(i.toString(2)).reverse().entries()

0 commit comments

Comments
 (0)