Snowflake interview question

Parallel courses 3 (LC hard)