Amazon interview question

Data Structures and algorithms drom codeforces