New York Times interview question

Code review round was challenging