java.lang.Object
g0001_0100.s0082_remove_duplicates_from_sorted_list_ii.Solution

public class Solution extends Object
82 - Remove Duplicates from Sorted List II.<p>Medium</p> <p>Given the <code>head</code> of a sorted linked list, <em>delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list</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/linkedlist1.jpg" alt="" /></p> <p><strong>Input:</strong> head = [1,2,3,3,4,4,5]</p> <p><strong>Output:</strong> [1,2,5]</p> <p><strong>Example 2:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2021/01/04/linkedlist2.jpg" alt="" /></p> <p><strong>Input:</strong> head = [1,1,1,2,3]</p> <p><strong>Output:</strong> [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 Details

    • Solution

      public Solution()
  • Method Details