function getDays (ranges: readonly (readonly [number, number])[]): number {
const days = new Set<number>();
for (const [start, end] of ranges) {
for (let time = start; end >= time; time += 8.64e7) {
days.add(time);
}
}
return days.size;
}
getDays([
[Date.parse("2021-01-02"), Date.parse("2021-01-05")],
[Date.parse("2021-01-04"), Date.parse("2021-01-06")],
]);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…