Amazon Interview Question

Asked about DSA of medium difficulty