LeetCode刷题(45)--Remove Duplicates from Sorted List
一个遍历列表,一个记录结果,一个记录head!
class Solution(object):def deleteDuplicates(self, head):""":type head: ListNode:rtype: ListNode"""if not head:return headcur = headdummy = headres = dummywhile cur.next:if cur.next.val != cur.val:dummy.next = cur.nextdummy = dummy.nextcur = cur.nextdummy.next = Nonereturn res
LeetCode刷题(45)--Remove Duplicates from Sorted List相关推荐
- leetcode python3 简单题26. Remove Duplicates from Sorted Array
1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第二十六题 (1)题目 英文: Given a sorted array nums, ...
- leetcode python3 简单题83. Remove Duplicates from Sorted List
1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第八十三题 (1)题目 英文: Given a sorted linked list ...
- 【leetcode刷题笔记】Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题 ...
- LeetCode集锦(八) - 第26题 Remove Duplicates From Sorted Array
LeetCode集锦(八) - 第26题 Remove Duplicates From Sorted Array 问题 Given a sorted array nums, remove the du ...
- Remove Duplicates from Sorted Array II -- LeetCode
原题链接: http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ 这道题跟Remove Duplicates ...
- 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:Remove Duplicates from Sorted List I II
LeetCode:Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such t ...
- LeetCode刷题记录15——21. Merge Two Sorted Lists(easy)
LeetCode刷题记录15--21. Merge Two Sorted Lists(easy) 目录 LeetCode刷题记录15--21. Merge Two Sorted Lists(easy) ...
- [leetcode]83.Remove Duplicates from Sorted List
题目 Given a sorted linked list, delete all duplicates such that each element appear only once. Exampl ...
- LeetCode算法入门- Remove Duplicates from Sorted Array -day21
LeetCode算法入门- Remove Duplicates from Sorted Array -day21 题目描述 Given a sorted array nums, remove the ...
最新文章
- r语言echarts画箱线图_echarts学习笔记之箱线图的分析与绘制详解
- java for index_Java增强for循环中获取index
- mybatis扫描mapper的xml文件参数
- 【简便代码】1082 射击比赛 (20分)_17行代码AC
- python 复制文件夹校验_Python多任务复制文件夹
- 传统家电在智能家居变革的五大优势
- spring集合的注入
- js reduce数组循环相加x+y
- Mybatis源码阅读(三):结果集映射3.2 —— 嵌套映射
- spring之Bean的生命周期
- 软/硬件负载均衡产品 你知多少?
- 实用typescript_TypeScript 泛型使用2-常见的工具类型
- python寻路_【PYTHON】a-start寻路算法
- pytorch---nn模块(3)自定义nn 模块
- 微计算机原理及应用大纲,《微型计算机原理及应用》考试大纲
- 阿里内核数据库文章-目录
- 【考研政治】2021肖八整理(时政部分)
- python中os.path.join()的循环用法_python中使用os.path.join()
- 184页10万字智慧城市公共服务中台:业务和数据中台建设方案
- MicroPython学习--Nokia 5110+DHT11温湿度显示