Meta interview question

I got a question from leetcode, Task Scheduler.