Pregunta de entrevista de Amazon

Data structures and Algorithms, programming question