Amazon interview question

coding question related to data structure