File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
count-days-spent-together Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ leetcode 测试
10
10
11
11
##### 包含的内容如下
12
12
13
+ https://leetcode.cn/problems/count-days-spent-together/
14
+
13
15
https://leetcode.cn/problems/reverse-odd-levels-of-binary-tree/
14
16
15
17
https://leetcode.cn/problems/smallest-even-multiple/
Original file line number Diff line number Diff line change
1
+ export default function countDaysTogether (
2
+ arriveAlice : string ,
3
+ leaveAlice : string ,
4
+ arriveBob : string ,
5
+ leaveBob : string ,
6
+ ) : number {
7
+ const arrive = arriveAlice > arriveBob ? arriveAlice : arriveBob ,
8
+ leave = leaveAlice < leaveBob ? leaveAlice : leaveBob ,
9
+ base = ( new Date ( `2021-${ leave } ` ) . valueOf ( ) -
10
+ new Date ( `2021-${ arrive } ` ) . valueOf ( ) ) /
11
+ ( 24 * 60 * 60 * 1000 ) + 1 ;
12
+ return Math . max ( base , 0 ) ;
13
+ }
You can’t perform that action at this time.
0 commit comments