# Remove Duplicates from Sorted List LeetCode Solution

Here, We see Remove Duplicates from Sorted List LeetCode Solution. This Leetcode problem is done in many programming languages like C++, Java, JavaScript, Python, etc. with different approaches.

# List of all LeetCode Solution

## Problem Statement

Given the `head` of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.

```Example 1:

Output: [1,2]

Example 2:

Output: [1,2,3]
```

## Remove Duplicates from Sorted List Leetcode Solution C++

``````class Solution {
public:
while(tmp && tmp -> next)
{
if(tmp -> val == tmp -> next -> val)
tmp -> next = tmp -> next -> next;
else
tmp = tmp -> next;
}
}
};```Code language: PHP (php)```

## Remove Duplicates from Sorted List Leetcode Solution Java

``````class Solution {
}
}```Code language: PHP (php)```

## Remove Duplicates from Sorted List Leetcode Solution JavaScript

``````var deleteDuplicates = function(head) {
while(current) {
if(current.next !== null && current.val == current.next.val) {
current.next = current.next.next;
} else {
current = current.next;
}
}
};```Code language: JavaScript (javascript)```

## Remove Duplicates from Sorted List Leetcode Solution Python

``````class Solution(object):