Pregunta de entrevista de Amazon

first interview OOP question second interview DFS question