Skip to content

Commit 67e9cf0

Browse files
committed
格式化
1 parent fc3b1ee commit 67e9cf0

File tree

2 files changed

+24
-25
lines changed
  • set-intersection-size-at-least-two
  • yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof

2 files changed

+24
-25
lines changed
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
function intersectionSizeTwo(intervals: number[][]): number {
2-
intervals.sort((a, b) => {
3-
return a[1] < b[1] || (a[1] === b[1] && a[0] > b[0]) ? -1 : 1;
4-
});
5-
6-
let last1 = -1;
7-
let last2 = -1;
8-
let res = 0;
9-
for (const q of intervals) {
10-
if (q[0] > last2) {
11-
last1 = q[1] - 1;
12-
last2 = q[1];
13-
res += 2;
14-
} else if (q[0] > last1) {
15-
last1 = last2;
16-
last2 = q[1];
17-
res++;
18-
}
19-
}
20-
return res;
21-
}
22-
export default intersectionSizeTwo;
1+
function intersectionSizeTwo(intervals: number[][]): number {
2+
intervals.sort((a, b) => {
3+
return a[1] < b[1] || (a[1] === b[1] && a[0] > b[0]) ? -1 : 1;
4+
});
5+
6+
let last1 = -1;
7+
let last2 = -1;
8+
let res = 0;
9+
for (const q of intervals) {
10+
if (q[0] > last2) {
11+
last1 = q[1] - 1;
12+
last2 = q[1];
13+
res += 2;
14+
} else if (q[0] > last1) {
15+
last1 = last2;
16+
last2 = q[1];
17+
res++;
18+
}
19+
}
20+
return res;
21+
}
22+
export default intersectionSizeTwo;

yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export default
2-
function lastRemaining(n: number, m: number): number {
3-
let f = 0;
1+
export default function lastRemaining(n: number, m: number): number {
2+
let f = 0;
43
for (let i = 2; i <= n; i++) {
54
f = (f + m) % i;
65
}

0 commit comments

Comments
 (0)