Amazon interview question

basic ds algo all from geeksforgeeks