Pregunta de entrevista de Amazon

Had to code and explain Leetcode medium questions.