Amazon Interview Question

some basic CS knowledge (not in my resume)