注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
There are tens of thousands of drivers; each submits hundreds of deliveries per week. Delivery records arrive immediately after a completed job; no persistence or thread-safety layer is required for the interview version.
Each driver has an hourly rate. A delivery pays driverHourlyRate * (endTime - startTime) / 3600.
Time is Unix epoch seconds using 64-bit integers. Each delivery has 0 < endTime - startTime <= 3 hours, and endTime is already in the past when recorded.
A driver may run multiple deliveries concurrently. For billinpaid cost, O(1).
Part 3: implement maxSimultaneousDriverInPast24Hours(now?: long) -> int, counting distinct drivers active at the same instant in [now - 86_400, now], not raw delivery count.
Optional variant: return the interval or intervals during which the maximum holds. |