Amazon Interview Question

coding question related to data structure