Pergunta de entrevista da empresa Red Hat

Question was based on Heap question