Amazon interview question

solving simil-leetcodes problems at home