You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can have the video explanation here : https://youtu.be/EjWw69vLVYo
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* llist, int position) { if(position == 0) return llist->next; SinglyLinkedListNode* curr = llist; while(position - 1) { curr = curr -> next; position--; } curr->next = curr->next->next; return llist; }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Delete a Node
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can have the video explanation here : https://youtu.be/EjWw69vLVYo