You are viewing a single comment's thread. Return to all comments →
Java 8 Solution:
public static SinglyLinkedListNode deleteNode(SinglyLinkedListNode llist, int position) { if (position == 0) { llist = llist.next; return llist; } SinglyLinkedListNode current = llist; llist = current; int index = 0; while (index < position - 1) { current = current.next; index++; } current.next = current.next.next; return llist; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete a Node
You are viewing a single comment's thread. Return to all comments →
Java 8 Solution: