Amazon interview question

not normal data structure and algo problem