[勇者闯LeetCode] 83. Remove Duplicates from Sorted List
[勇者闯LeetCode] 83. Remove Duplicates from Sorted List
Description
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given1->1->2
, return1->2
.
Given1->1->2->3->3
, return1->2->3
.
Information
- Tags: Linked List
- Difficulty: Easy
Solution
# 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"""ans = headwhile ans is not None and ans.next is not None:if ans.next.val == ans.val:ans.next = ans.next.nextelse:ans = ans.nextreturn head
[勇者闯LeetCode] 83. Remove Duplicates from Sorted List相关推荐
- [leetcode]83.Remove Duplicates from Sorted List
题目 Given a sorted linked list, delete all duplicates such that each element appear only once. Exampl ...
- LeetCode 83. Remove Duplicates from Sorted List
题目: Given a sorted linked list, delete all duplicates such that each element appear only once. For e ...
- LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] c++
LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] <c++> 给出排序好的 ...
- Leetcode OJ: Remove Duplicates from Sorted Array I/II
删除排序数组重复元素,先来个简单的. Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates i ...
- LeetCode 80. Remove Duplicates from Sorted Array II
80. Remove Duplicates from Sorted Array II My Submissions QuestionEditorial Solution Total Accepted: ...
- LeetCode之Remove Duplicates from Sorted Array II
1.题目 Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For ...
- leetcode python3 简单题83. Remove Duplicates from Sorted List
1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第八十三题 (1)题目 英文: Given a sorted linked list ...
- 【leetcode】Remove Duplicates from Sorted Array
题目:Given a sorted array, remove the duplicates in place such that each element appear only once and ...
- LeetCode之Remove Duplicates from Sorted Array
1.题目 Given a sorted array, remove the duplicates in place such that each element appear only once an ...
最新文章
- centos7 升级 gdb
- oracle+字段+virtual,Oracle 11g新特性之--虚拟列(Virtual Column)
- 博士申请 | 约翰霍普金斯大学招收2022年入学trustworthy AI方向博士生
- MyBatis自定义类型处理器 TypeHandler
- c#如何识别一张图片的格式
- 大二《数据结构》机考解题报告
- 中富之命能有多少钱_邯郸白铁风管工每天工资多少钱?白铁风管价格多少钱你能接受?...
- js 取get过来的数据
- VueSSR高阶指南
- Intel微处理器列表_百度百科
- 移动端tap或touch类型事件的点透问题认识
- flowable 清除流程本地缓存
- 精品免费软件更新下载
- 计算机电脑设置音量,电脑声卡设置步骤【图文教程】
- 门禁管理系统(Swing/Dos)
- Teradata天睿公司任命王波为大中华区总裁
- mp3 编辑 linux,Linux_Ubuntu 32/64位安装音乐标签编辑器Kid3的方法, Kid3能够修改mp3中ID3的tag标 - phpStudy...
- 通过双目深度相机获取三维坐标
- 日期转换 例如 二零零六年十二月二十一日 转换成 2006年12月21日
- 《卸甲笔记》-基础语法对比