題目
原題頁面:https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/
題目型別:Linked List
難度評價:Medium
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given1->2->3->3->4->4->5, return1->2->5.
Given1->1->1->2->3, return2->3.
分析
和Remove Duplicates from Sorted List差不多的題目,區別是對於重複的元素不是去重,而是完全地刪除重複出現過的元素。
程式碼
1 | class Solution: |
本文地址:https://xnerv.wang/zh-tw/leetcode-remove-duplicates-from-sorted-list-ii/
