83. Remove Duplicates from Sorted List

来源:互联网 发布:希望有鬼知乎 编辑:程序博客网 时间:2024/06/05 13:32
public static ListNode deleteDuplicates(ListNode head) {        if(head == null) {            return head;        }        ListNode thead = head,tcur = head,cur = head;        while(cur != null) {            if(tcur.val != cur.val) {                tcur.next = cur;                tcur = cur;            }            cur = cur.next;        }        tcur.next = null;        return thead;    }
0 0
原创粉丝点击