Amazon interview question

standard leet code question with time limit