82. Remove Duplicates from Sorted List II
来源:互联网 发布:pagerank算法新应用 编辑:程序博客网 时间:2024/05/17 02:18
public static ListNode deleteDuplicates(ListNode head) { if(head == null || (head != null && head.next == null)){ return head; } ListNode cur = head.next, thead = head, tcur = head,pre = null; boolean isDu = false; while(cur != null) { if(cur.val == tcur.val) { isDu = true; }else if(cur.val != tcur.val && isDu) { if(pre == null) { thead = cur; tcur = cur; }else { pre.next = cur; tcur = cur; } isDu = false; }else if(cur.val != tcur.val && !isDu) { pre = tcur; tcur.next = cur; tcur = cur; } cur = cur.next; } if(isDu) { if(pre == null) { thead = null; }else { pre.next = null; } }else { tcur.next = null; } return thead; }
0 0
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- 82. Remove Duplicates from Sorted List II
- html border画三角形
- Unity3D 关于资源加载(Resources和AssetBundle)和内存管
- 写给Android开发者的混淆使用手册
- Supporting Different Devices笔记
- textview中实现字体变色
- 82. Remove Duplicates from Sorted List II
- 集中式日志系统 ELK 协议栈详解
- jQuery中的Ajax
- poj 1149 最大流之Ford Fulkerson算法
- LeetCode 345.Reverse Vowels of a String
- 在android中使用ThreadPoolExector
- 为分组管理添加修改功能
- JAVA8 十大新特性详解
- (M)328. Odd Even Linked List