Roblox interview question

a priority queue problem with 2 parts