10000 Easy · codersaga/HackerRank@b3a8c0e · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
Easy
Browse files Browse the repository at this point in the history
  • Loading branch information
codersaga authored May 3, 2020
1 parent dbdde25 commit b3a8c0e
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


// Complete the removeDuplicates function below.

/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode next;
* }
*
*/
static SinglyLinkedListNode removeDuplicates(SinglyLinkedListNode head) {
SinglyLinkedListNode th=head;
if(head==null){
return null;
}
while(head.next!=null){
if(head.data==head.next.data){
head.next=head.next.next;
}
else{
head=head.next;
}
}
return th;
}

0 comments on commit b3a8c0e

Please sign in to comment.
0