My favorite coding question to give candidates (and why)

A coding interview question, from the viewpoint of an Google/Amazon/Microsoft interviewer