Amazon interview question

data structure question