Pregunta de entrevista de Amazon

Data structure and coding. Coding is very easy.