Pregunta de entrevista de Red Hat

Question was based on Heap question