Google Interview Question

Based on the concepts of priority queue