You are viewing a single comment's thread. Return to all comments →
This works too:
Node RemoveDuplicates(Node head) { if ( head == null ) return null; Node nextItem = head.next; while ( nextItem != null && head.data == nextItem.data ) { nextItem = nextItem.next; } head.next = RemoveDuplicates( nextItem ); return head; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete duplicate-value nodes from a sorted linked list
You are viewing a single comment's thread. Return to all comments →
This works too: