Pregunta de entrevista de Google

Basic stack question with a followup