链表是升序排列,一次遍历只需比较和前一个节点是否相等,相等就删除

# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None

#
# 
# @param head ListNode类 
# @return ListNode类
#
class Solution:
    def deleteDuplicates(self , head ):
        # write code here
        dump = ListNode(0)
        dump.next = head
        while head and head.next:
            if head.val == head.next.val:
                head.next = head.next.next
                continue
            head = head.next
        return dump.next