Pergunta de entrevista da empresa Meta

I got a question from leetcode, Task Scheduler.