Google interview question

Basic stack question with a followup