[勇者闯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,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->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相关推荐

  1. [leetcode]83.Remove Duplicates from Sorted List

    题目 Given a sorted linked list, delete all duplicates such that each element appear only once. Exampl ...

  2. LeetCode 83. Remove Duplicates from Sorted List

    题目: Given a sorted linked list, delete all duplicates such that each element appear only once. For e ...

  3. 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++> 给出排序好的 ...

  4. Leetcode OJ: Remove Duplicates from Sorted Array I/II

    删除排序数组重复元素,先来个简单的. Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates i ...

  5. LeetCode 80. Remove Duplicates from Sorted Array II

    80. Remove Duplicates from Sorted Array II My Submissions QuestionEditorial Solution Total Accepted: ...

  6. LeetCode之Remove Duplicates from Sorted Array II

    1.题目 Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For ...

  7. leetcode python3 简单题83. Remove Duplicates from Sorted List

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第八十三题 (1)题目 英文: Given a sorted linked list ...

  8. 【leetcode】Remove Duplicates from Sorted Array

    题目:Given a sorted array, remove the duplicates in place such that each element appear only once and ...

  9. LeetCode之Remove Duplicates from Sorted Array

    1.题目 Given a sorted array, remove the duplicates in place such that each element appear only once an ...

最新文章

  1. centos7 升级 gdb
  2. oracle+字段+virtual,Oracle 11g新特性之--虚拟列(Virtual Column)
  3. 博士申请 | 约翰霍普金斯大学招收2022年入学trustworthy AI方向博士生
  4. MyBatis自定义类型处理器 TypeHandler
  5. c#如何识别一张图片的格式
  6. 大二《数据结构》机考解题报告
  7. 中富之命能有多少钱_邯郸白铁风管工每天工资多少钱?白铁风管价格多少钱你能接受?...
  8. js 取get过来的数据
  9. VueSSR高阶指南
  10. Intel微处理器列表_百度百科
  11. 移动端tap或touch类型事件的点透问题认识
  12. flowable 清除流程本地缓存
  13. 精品免费软件更新下载
  14. 计算机电脑设置音量,电脑声卡设置步骤【图文教程】
  15. 门禁管理系统(Swing/Dos)
  16. Teradata天睿公司任命王波为大中华区总裁
  17. mp3 编辑 linux,Linux_Ubuntu 32/64位安装音乐标签编辑器Kid3的方法,  Kid3能够修改mp3中ID3的tag标 - phpStudy...
  18. 通过双目深度相机获取三维坐标
  19. 日期转换 例如 二零零六年十二月二十一日 转换成 2006年12月21日
  20. 《卸甲笔记》-基础语法对比

热门文章

  1. python selenium 不弹出浏览器
  2. SWUST OJ 1159 吃披萨
  3. 【mmdetection源码解读(二)】RPN网络
  4. 《儿女英雄传》不符合国情的地方
  5. Github上最好用的Android状态栏导航栏库
  6. 软文的写作四大策略及技巧
  7. ChatGPT 官方 App 在更多地区上线,含欧洲、韩国、新西兰等
  8. ffmpeg常用命令-调整视频颜色
  9. php 美颜,使用face++实现人像美颜
  10. 汉诺塔算法 蒙特卡诺算法