Class Solution
java.lang.Object
g0001_0100.s0083_remove_duplicates_from_sorted_list.Solution
83 - Remove Duplicates from Sorted List.<p>Easy</p>
<p>Given the <code>head</code> of a sorted linked list, <em>delete all duplicates such that each element appears only once</em>. Return <em>the linked list <strong>sorted</strong> as well</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/list1.jpg" alt="" /></p>
<p><strong>Input:</strong> head = [1,1,2]</p>
<p><strong>Output:</strong> [1,2]</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/list2.jpg" alt="" /></p>
<p><strong>Input:</strong> head = [1,1,2,3,3]</p>
<p><strong>Output:</strong> [1,2,3]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in the list is in the range <code>[0, 300]</code>.</li>
<li><code>-100 <= Node.val <= 100</code></li>
<li>The list is guaranteed to be <strong>sorted</strong> in ascending order.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
deleteDuplicates
-