[leetcode][83]Remove Duplicates from Sorted List
来源:互联网 发布:domori巧克力知乎 编辑:程序博客网 时间:2024/06/06 03:56
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2
, return 1->2
.
Given 1->1->2->3->3
, return 1->2->3
.
# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ if head is None: return head node = head while node.next: if node.val == node.next.val: node.next = node.next.next continue node = node.next return head
0 0
- LeetCode(83)Remove Duplicates from Sorted List
- [leetcode 83]Remove Duplicates from Sorted List
- [leetcode]83 Remove Duplicates from Sorted List
- [leetcode 83]Remove Duplicates from Sorted List
- leetcode-83 Remove Duplicates from Sorted List
- leetcode || 83、Remove Duplicates from Sorted List
- LeetCode 83 Remove Duplicates from Sorted List
- LeetCode---(83) Remove Duplicates from Sorted List
- leetcode 83 Remove Duplicates from Sorted List
- LeetCode 83:Remove Duplicates from Sorted List
- leetcode[83]:Remove Duplicates from Sorted List
- Leetcode[83]-Remove Duplicates from Sorted List
- Leetcode #83 Remove Duplicates from Sorted List
- leetcode 83: Remove Duplicates from Sorted List
- leetcode: (83) Remove Duplicates from Sorted List
- [Leetcode]#83 Remove Duplicates from Sorted List
- LeetCode 83 - Remove Duplicates from Sorted List
- [LeetCode-83] Remove Duplicates from Sorted List
- Repeated Substring Pattern
- TEC1401.Report开发技术总结 - 第六章 使用BI Publisher开发报表-创建XML数据源(1/5)
- Hession与Webservice的区别
- 数据结构:二叉查找树的相关操作
- JavaScript 运行机制详解:再谈Event Loop
- [leetcode][83]Remove Duplicates from Sorted List
- [leetcode][67] Add Binary
- Binary Tree Right Side View
- 学习的文档位置
- TEC1401.Report开发技术总结 - 第七章 使用BI Publisher开发报表-创建一个简单的RTF模板(2/5)
- TEC1401.Report开发技术总结 - 第八章 使用BI Publisher开发报表-在EBS应用中部署BIP报表(3/5)
- Leetcode 99. Recover Binary Search Tree (Hard) (cpp)
- [leetcode][155] Min Stack
- Spring架构图