leetcode Remove Duplicates from Sorted List II
来源:互联网 发布:淘宝店铺标志怎么没了 编辑:程序博客网 时间:2024/04/29 21:10
题目链接
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Solution { public ListNode deleteDuplicates(ListNode head) { if(head==null) { return head; } ListNode workHead=new ListNode(0); workHead.next=head; ListNode current=head; ListNode pre=workHead; boolean isDelete=false; while(current.next!=null) { if(current.val==current.next.val) { isDelete=true; current.next=current.next.next; } else if(isDelete) { isDelete=false; pre.next=current.next; current=current.next; } else { pre=current; current=current.next; } } if(isDelete) { pre.next=current.next; } return workHead.next; }}
0 0
- LeetCode: Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted List II
- LeetCode: Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted List II
- [leetcode] Remove Duplicates from Sorted List II
- [LeetCode] Remove Duplicates from Sorted List II
- [leetcode] Remove Duplicates from Sorted List II
- [LeetCode]Remove Duplicates from Sorted List II
- [leetcode]Remove Duplicates from Sorted List II
- LeetCode-Remove Duplicates from Sorted List II
- [leetcode] Remove Duplicates from Sorted List II
- LeetCode - Remove Duplicates from Sorted List II
- LeetCode | Remove Duplicates from Sorted List II
- LeetCode:Remove Duplicates from Sorted List II
- 【leetcode】Remove Duplicates from Sorted List II
- Leetcode: Remove Duplicates from Sorted List II
- leetcode Remove Duplicates from Sorted List II
- [LeetCode] Remove Duplicates from Sorted List II
- Jira和Confluence集成Crowd实现SSO-构建高效的团队协作工具
- Python 运算符
- Cloudera升级☞第一篇Cloudera Manager升级
- svg 二次曲线
- 第一次去面试
- leetcode Remove Duplicates from Sorted List II
- 如何在googleplay上发布应用?
- java企业级应用之术语篇
- 排序算法(2)-快速排序
- Android View 的尺寸大小变化的时候要求有一个过度的动画
- 属性动画 自定义属性
- 14.2.3 InnoDB Redo Log
- const 与define
- Android版本和API Level对应关系