You are viewing a single comment's thread. Return to all comments →
Node Insert(Node head,int data) { Node newNode = new Node(); newNode.next = null; newNode.data = data; if(head == null){ head = newNode; } else{ Node tailNode = head; while(tailNode.next != null){ tailNode = tailNode.next; } tailNode.next = newNode; } return head; }
Input (stdin) 3 247 678 159 17
Your Output (stdout) Right Answer!
Expected Output 247 678 159 17
Compiler Message Wrong Answer
Any pointer as to what is that needs to be fixed here? Any response is appreciated. Thank you
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a Node at the Tail of a Linked List
You are viewing a single comment's thread. Return to all comments →
Input (stdin) 3 247 678 159 17
Your Output (stdout) Right Answer!
Expected Output 247 678 159 17
Compiler Message Wrong Answer
Any pointer as to what is that needs to be fixed here? Any response is appreciated. Thank you