leetcode83Remove Duplicates from Sorted List
来源:互联网 发布:经典文案 知乎 编辑:程序博客网 时间:2024/06/10 00:25
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
dummy=head
while head and head.next:
if head.val==head.next.val:
head.next=head.next.next
else:
head=head.next
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
dummy=head
while head and head.next:
if head.val==head.next.val:
head.next=head.next.next
else:
head=head.next
return dummy
https://leetcode.com/problemset/algorithms/
0 0
- leetcode83Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove duplicates from sorted list
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List
- 石油大 2017年省赛前最后一水 1023: Pong’s Birds
- Ftp 链接服务器 多次失败
- 迷宫问题(dfs)POJ
- Android快速开发系列 10个常用工具类
- 常用排序算法之希尔排序
- leetcode83Remove Duplicates from Sorted List
- MySQL(2)-约束的添加及删除
- 计算机网络基础——网络的性能
- 怎么判断IOS安装包中是否包含jspatch代码
- C语言实现菱形星星
- 【HTML5学习笔记】9:音频和视频的嵌入
- Chisel手册之Types
- 常用排序算法之简单选择排序
- CentOS 下安装 Node.js