Remove Duplicates from Sorted List


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.
Solution: my answer might not be optimized, using the most straightforward implementation in my mind...
The following code passes LeetCode Online Large Judge.
2013-05-28 redo, BUG FREE

Comments

Popular posts from this blog

Maximum Gap

[ITint5] Maximum Subarray for a Circular Array

[CC150] Chapter 4 Trees and Graphs