【LeetCode with Python】 Remove Duplicates from Sorted List
来源:互联网 发布:阿里云 code 代码托管 编辑:程序博客网 时间:2024/05/21 06:25
博客域名:http://www.xnerv.wang
原题页面:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/
题目类型:链表
难度评价:★
本文地址:http://blog.csdn.net/nerv3x3/article/details/3465647
有序链表的去重,注意及时检查一些引用是否为None。
原题页面:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/
题目类型:链表
难度评价:★
本文地址:http://blog.csdn.net/nerv3x3/article/details/3465647
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.
For example,
Given 1->1->2
, return 1->2
.
Given 1->1->2->3->3
, return 1->2->3
.
有序链表的去重,注意及时检查一些引用是否为None。
class Solution: # @param head, a ListNode # @return a ListNode def deleteDuplicates(self, head): if None == head or None == head.next: return head cur = head while None != cur: if None != cur.next and cur.val == cur.next.val: cur.next = cur.next.next continue else: cur = cur.next return head
- 【LeetCode with Python】 Remove Duplicates from Sorted List
- 【LeetCode with Python】 Remove Duplicates from Sorted List II
- Leetcode-Remove Duplicates from Sorted List-Python
- 【Leetcode】【python】Remove Duplicates from Sorted List/Remove Duplicates from Sorted List II
- Remove Duplicates from Sorted List :from LeetCode
- 【LeetCode with Python】 Remove Duplicates from Sorted Array
- 【LeetCode with Python】 Remove Duplicates from Sorted Array II
- Leetcode - List - Remove Duplicates from Sorted List
- [leetcode][list] Remove Duplicates from Sorted List
- [leetcode][list] Remove Duplicates from Sorted List
- Python学习——leetcode(Remove Duplicates from Sorted List)
- 【leetcode OJ】Remove Duplicates from Sorted List(python)
- 83. Remove Duplicates from Sorted List Leetcode Python
- 82. Remove Duplicates from Sorted List II Leetcode Python
- 【LEETCODE】82- Remove Duplicates from Sorted List II [Python]
- [leetcode:python]83.Remove Duplicates from Sorted List
- 链表-python-leetcode 83 Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted List
- 幸福和不幸
- 我10年来的学习和生活
- IT管理人才必备的十大能力
- 代码下载网址
- 伟大的make.exe
- 【LeetCode with Python】 Remove Duplicates from Sorted List
- 【LeetCode with Python】 Remove Duplicates from Sorted Array
- 【LeetCode with Python】 Pow(x, n)
- 计算机方面电子书
- 迄今为止10大恼人科技:弹出式广告居首
- 十年经典书籍下载
- 【LeetCode with Python】 Pascal's Triangle
- 【LeetCode with Python】 Merge Two Sorted Lists
- 【LeetCode with Python】 Merge Sorted Array