Solve Google's Frontend Interview Question: Concurrency + Priority