Many timers on top of one underlying timer

0
Remix

The system offers a single timer: setting it replaces any earlier setting, and it calls a handler when it expires. Build a class that supports many independent timers on top of it: add a timer for a timestamp, cancel one, and fire each at the right time. Keep the next deadline in a min-heap and re-arm the single timer whenever the earliest deadline changes.

GoogleOnline assessmentLast asked Dec 2025
No answer yet. Write the first one; the best answer gets endorsed.