Amazon interview question

some basic CS knowledge (not in my resume)