Varsity Tutors interview question

How would you do/explain this problem?