leetcode Remove Duplicates from Sorted Lists
来源:互联网 发布:数控电火花编程实例 编辑:程序博客网 时间:2024/06/07 00:04
/** * 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 head; } ListNode* tmp = head; ListNode* next = tmp->next; //ListNode* prev = tmp; while(next){ if(next->val == tmp->val){ ListNode*tmpnext = next->next; tmp->next = tmpnext; delete next; next = tmpnext; } else{ tmp = next; next = next->next; } } return head; }};
0 0
- leetcode Remove Duplicates from Sorted Lists
- leetcode83.Remove Duplicates from Sorted Lists
- Remove Duplicates from Sorted List :from LeetCode
- LeetCode: Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted Array
- LeetCode: Remove Duplicates from Sorted List II
- LeetCode: Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted Array
- [Leetcode] Remove Duplicates from Sorted Array II
- [Leetcode] Remove Duplicates from Sorted List
- [Leetcode] Remove Duplicates from Sorted List II
- LeetCode: Remove Duplicates from Sorted Array
- LeetCode: Remove Duplicates from Sorted Array II
- LeetCode: Remove Duplicates from Sorted List
- LeetCode: Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted List II
- [Leetcode] Remove Duplicates from Sorted Array II
- leetcode 35: Remove Duplicates from Sorted Array
- 分页工具类
- TQ2440裸奔三部曲1.1和1.2将3.5屏显示升级为4.3屏
- 设计模式梳理总结(1)
- 【安卓】数据存储之SharedPreferences
- SGU - 222 Little Rooks
- leetcode Remove Duplicates from Sorted Lists
- leetcode remove duplicates from sorted array
- 网络编程(1)--利用socket进行客户端与服务器端的通信
- 栋栋晓10:Javascript学习总结:基础知识2(语句,函数,)
- HDU - 2816 I Love You Too(水)
- 【Android基础篇】AlertDialog自定义setView方法的控件响应方法
- POJ2406 KMP next数组妙用
- HDU 1787 GCD Again 【欧拉函数模板】
- 【iOS开发】深入MVC---UITableView的数据源方法封装