83. Remove Duplicates from Sorted List
来源:互联网 发布:星火英语怎么样 知乎 编辑:程序博客网 时间:2024/06/13 21:22
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.
思路
if cur->val == cur->next->valdelete cur->next
代码(C)
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* deleteDuplicates(struct ListNode* head) { if (NULL == head) return head; struct ListNode* temp = head; while (head->next != NULL) { if (head->val == head->next->val) head->next = head->next->next; else head = head->next; } return temp;}
0 0
- [LeetCode]83.Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- [Leetcode] 83. Remove Duplicates from Sorted List
- LeetCode --- 83. Remove Duplicates from Sorted List
- [leetcode] 83.Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- LeetCode 83. Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- 【leetcode】83. Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List LeetCode
- 83. Remove Duplicates from Sorted List
- leetcode 83. Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- 83. Remove Duplicates from Sorted List
- [LeetCode]83. Remove Duplicates from Sorted List
- 【LeetCode】83. Remove Duplicates from Sorted List
- LeetCode 83. Remove Duplicates from Sorted List
- Python的基本数据类型之Number以及String
- windows10中最强大王爽汇编语言学习环境
- java复习之多线程的简单理解
- mac下使用Elecard Video QuEst比较视频质量
- LeetCode: ZigZag Conversion
- 83. Remove Duplicates from Sorted List
- DHTMLX做一个Grid列表显示数据
- segment
- Numpy(3)
- 设计模式
- web前端学习(4)
- iOS中集成ijkplayer视频直播框架
- CCF——最优灌溉(最小生成树)
- 读书笔记之《大型网站技术架构》