82. Remove Duplicates from Sorted List II
来源:互联网 发布:易酷cms插件 编辑:程序博客网 时间:2024/06/11 04:58
对于这种链表题已经很熟练了,一次AC
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* deleteDuplicates(ListNode* head) { if(head==NULL) return NULL; ListNode* prenow=NULL; ListNode* now=head; ListNode* next=head->next; while(next!=NULL) { if(now->val==next->val) { while(next!=NULL&&now->val==next->val) next=next->next; if(prenow==NULL) head=next; else prenow->next=next; now=next; if(next!=NULL) next=next->next; } else { prenow=now; now=next; next=next->next; } } return head; }};
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
- 死锁的条件
- MySQL的Innodb doublewrite buffer来龙去脉
- Linux基础
- 判断是否为子树
- sizeof()和strlen()
- 82. Remove Duplicates from Sorted List II
- 页断裂(partial write)与doublewrite技术
- ubuntu日常使用
- 系统集成项目管理工程师教程看书笔记7
- COOKIE与SESSION的区别与联系
- NoSuchMethodError:org.apache.spark.rdd.RDD.mapPartitionsInternal$default$2()Z
- POJ 1456
- 《ACM程序设计》书中题目T 第二十题 找底数
- Android应用安全与校验之反动态调试