Amazon interview question

question related to DSA and coding