Amazon Interview Question

question related to DSA and coding