Adobe interview question

A leetcode medium questions based on priority queue