题目

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.

代码

 public static ListNode deleteDuplicates(ListNode head) {if (head==null || head.next==null) return head; ListNode first = head;ListNode second=head.next;while(second!=null){if(first.val==second.val){second=second.next;first.next=second;}                else{first=first.next;second=first.next;                      }}return head;}
代码下载:https://github.com/jimenbian/GarvinLeetCode

/********************************

* 本文来自博客  “李博Garvin“

* 转载请标明出处:http://blog.csdn.net/buptgshengod

******************************************/

【LeetCode从零单排】No83 Remove Duplicates from Sorted List相关推荐

  1. leetcode python3 简单题26. Remove Duplicates from Sorted Array

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

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

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

  3. Remove Duplicates from Sorted Array II -- LeetCode

    原题链接: http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/  这道题跟Remove Duplicates ...

  4. LeetCode集锦(八) - 第26题 Remove Duplicates From Sorted Array

    LeetCode集锦(八) - 第26题 Remove Duplicates From Sorted Array 问题 Given a sorted array nums, remove the du ...

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

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

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

  7. LeetCode算法入门- Remove Duplicates from Sorted Array -day21

    LeetCode算法入门- Remove Duplicates from Sorted Array -day21 题目描述 Given a sorted array nums, remove the ...

  8. LeetCode:Remove Duplicates from Sorted List I II

    LeetCode:Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such t ...

  9. [勇者闯LeetCode] 83. Remove Duplicates from Sorted List

    [勇者闯LeetCode] 83. Remove Duplicates from Sorted List Description Given a sorted linked list, delete ...

最新文章

  1. calipso是什么意思_眰恦是什么意思?
  2. Oracle怎样创建共享文件夹,Oracle vm要如何使用共享文件夹的解决方法
  3. 一招教你掌握肌肉发力的感觉
  4. 12.04 深圳站 | Serverless Developer Meetup 开放报名啦
  5. Tasker文件夹说明
  6. 30-- A 代码记录分析
  7. 如何优雅地检测类型/表达式有效性?
  8. 2018秋季C语言学习总结
  9. 手把手带你玩转Tensorflow 物体检测 API (4)—— 模型验证
  10. ERP软件的追加开发环节存在特殊价值
  11. Cisco IOS Unicast NAT 工作原理 [一]
  12. opencv颜色识别_opencv-python污水颜色识别
  13. 高吞吐消息中间件Kafka集群环境搭建(3台kafka,3台zookeeper)
  14. birt java api_「Birt」birt api生成报表 | 学步园
  15. 02--Activiti初始化表
  16. Starting MySQL. ERROR! The server quit without updating PID file
  17. listView 下拉动态加载数据
  18. python分组求和_利用pandas进行分组求和
  19. 单片机万年历阴阳历c语言,自己制作的单片机万年历 程序+原理图
  20. IP代理池Proxy_Pool使用教程(Windows版)

热门文章

  1. 安卓代码拉下来编译后怎么运行_支付宝秒开是因为用了方舟编译器?官方回应...
  2. ssm 异常捕获 统一处理_统一异常处理介绍及实战
  3. 计算机控制zos,第二章zOS操作系统的功能概述2.1zOS的内存管理.PDF
  4. dubbo service注解用法_Dubbo---开源分布式服务框架(一)
  5. 应用程序错误电脑黑屏_电脑黑屏了怎么办,电脑硬件win黑屏的6大原因以及解决方法...
  6. mysql fetch时间太长_sql_trace用法,fetch太多行需要运行很久怎么解决?
  7. 采集标签_科创致远轻MES工时采集系统帮助工厂快速构建工效节拍绩效考核
  8. java反射泛型类型,【Java反射】Java 泛型基础
  9. Oracle的数据备份与恢复
  10. gcc编译选项-o和-c介绍