Linked list k append

while i was trying to implement using STL I am getting wrong answer on one of the test case
pls tell where it is wrong?

Hey,you shouldn’t solve it using stl.Mostly in linked problem you are given head of the list and you have to complete the function using head only.So try to solve it by actually making a linked and list and then doing the operation specified in the question.It is a bad pratice to solve the way you are solving.