Varsity Tutors Interview Question

How would you do/explain this problem?