Amazon Interview Question

not normal data structure and algo problem