Amazon interview question

2nd question was on linkedlist