LeetCode-Remove Duplicates from Sorted List
来源:互联网 发布:gradle mac 环境变量 编辑:程序博客网 时间:2024/05/02 04:22
#include <iostream>using namespace std;struct ListNode{ int val; ListNode* next;};ListNode* deleteDuplicates(ListNode *head){ if(head==NULL) return NULL; ListNode* pNode=head; ListNode* pHead=head; while(pNode!=NULL) { while(pNode->next!=NULL&&pNode->val==pHead->val) { pNode=pNode->next; } if(pNode->val!=pHead->val) { pHead->next=pNode; pHead=pNode; pNode=pNode->next; } else//防止出现 1->1 { pHead->next=NULL; return head; } } return head;}
0 0
- Remove Duplicates from Sorted List :from LeetCode
- Leetcode - List - Remove Duplicates from Sorted List
- [leetcode][list] Remove Duplicates from Sorted List
- [leetcode][list] Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted List
- [Leetcode] Remove Duplicates from Sorted List II
- LeetCode: Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted List II
- leetcode 37: Remove Duplicates from Sorted List
- [leetcode] Remove Duplicates from Sorted List II
- [LeetCode] Remove Duplicates from Sorted List II
- [LeetCode] Remove Duplicates from Sorted List
- [leetcode] Remove Duplicates from Sorted List
- [leetcode] Remove Duplicates from Sorted List II
- [LeetCode]Remove Duplicates from Sorted List
- 【JAVASE】工具类防止调用者实例化
- Apache无法启动解决 the requested operation has failed
- Go语言 常用日志记录方法
- 《C++程序设计语言》9_源文件和程序
- 二叉树的先序、中序、后续遍历的递归和非递归实现
- LeetCode-Remove Duplicates from Sorted List
- 海量数据处理:十道面试题与十个海量数据处理方法总结
- Android 地理编码
- leetcode之Palindrome Partitioning II
- static private
- smali 语法学习历程
- 排列组合的高效算法
- Password file
- linux终端下的文本颜色设置