Amazon interview question

there were medium questions from hackerrank