Appian Interview Question

leetcode type technical question on heaps