Roblox Interview Question

The second coding question seemed to require queues and a hashmap.