Pregunta de entrevista de Amazon

Easy leetcode question was asked