You are viewing a single comment's thread. Return to all comments →
because the question asks to "return the head of the updated linked list". In your case you're returning the pointer (is that correct Java terminology?) to the last node.
I did the same mistake, initially and was scratching my head to figured where I went wrong. Hence people say understanding the requirement is important. You may right functionally correct code, but if that is not meeting the requirement, then the whole purpose of your program/app is defeated.