双指针:空间复杂度O(1),时间复杂度O(n)
 public ListNode deleteDuplicates (ListNode head) {
        if(head==null){
            return null;
        }
        // write code here
        ListNode pre = head;
        ListNode preNext = head.next;
        while(preNext!=null){
            if(pre.val!=preNext.val){
               pre.next=preNext;
                pre = preNext;
            }
            preNext=preNext.next;
        }
        pre.next=preNext;
        return head;
    }