83. 删除排序链表中的重复元素

class Solution {
public ListNode deleteDuplicates(ListNode head) {
		if (head == null)
			return null;
		ListNode ls = head;
		while (ls.next != null) {
			if (ls.val != ls.next.val) {
				ls = ls.next;
			} else {
				ls.next = ls.next.next;
			}
		}
		return head;
	}
}

原文地址:https://www.cnblogs.com/cznczai/p/11226013.html