Roblox Interview Question

a priority queue problem with 2 parts