83. [E] Remove Duplicates from Sorted List

https://leetcode.com/problems/remove-duplicates-from-sorted-list/

无他,遍历过去就是

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