Nextbite Interview Question

Problem to solve on coderpad which involves using priority queues and heaps