Pregunta de entrevista de Amazon

Both coding questions were easy