Coding Blocks Interview Question

DSA question on Priority Queue