Pregunta de entrevista de Nasdaq

solve some problems in the code