Tried the 1->2->3->4 and the output its not the correct answer


I used the 1->2->3->4 in the expected output and this happens.

Maybe its and error, or not just reporting ^^.


Read the input format carefully
" Line 1 ( Corresponds to arg 1 ) : Elements in the linked list. First number S is the number of nodes. Then S numbers follow indicating the val in each of the nodes in sequence For example, LinkedList: “5 --> 9 --> 7” will be written as “3 5 9 7”(without quotes)."

This should answer your question


Yeah, :sweat_smile:
Thank you