Microsoft Interview Question

The question was based on a heap