题目:

代码为:
public class Solution {
public ListNode DeleteDuplicates(ListNode head) {
if(head==null)
return null;
ListNode node=head;
while(node.next!=null)
{
if(node.val==node.next.val)
node.next=node.next.next;
else node=node.next;
} return head;
}
}
运行结果为:
