oj83. Remove Duplicates from Sorted List
来源:互联网 发布:哪里可以学淘宝美工 编辑:程序博客网 时间:2024/05/16 19:51
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
.
翻译:
给定一个排序的链接列表,删除所有重复项,使每个元素只显示一次。
例如,
给定1->1->2
,返回1->2
。
给予1->1->2->3->3
,回报1->2->3
。
public ListNode deleteDuplicates(ListNode head) { ListNode result = head; while(head != null){ if(head.next == null){ break; } if(head.val == head.next.val){ head.next = head.next.next; }else{ head = head.next; } } return result; }
0 0
- oj83. 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
- Remove Duplicates from Sorted List
- 在计算机中,输出一个整数二进制中1的个数.
- 有关solr的网址
- 期中考试的一点反思
- Algorithm Gossip (22) 中序式转后序式(前序式)
- 后代选择器,雪碧图
- oj83. Remove Duplicates from Sorted List
- 最简单的Dialog程序
- Ecshop模板开发(二十七):列表页筛选功能、清除筛选、高级搜索实现
- springMvc 的参数验证 BindingResult result 的使用
- myeclipse2015和tomcat7部署出现访问不到
- HDU 1003 Max Sum【区间最大值】题解
- 深入理解C语言中的.h文件和.c文件
- 【C#】学习笔记不拉不拉
- docker pure-ftp 搭建ftp服务器