Amazon Interview Question

based on data structure and algorithms