| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/feixiangcode/algorithm/master/Week_01/id_129/LeetCode_2_129.java | [Back] [Original] |
public class LeetCode_2_129 {
public static ListNode deleteDuplicates(ListNode head) {
if (head == null) return head;
ListNode cursor = head;
while (cursor != null && cursor.next != null) {
if (cursor.val == cursor.next.val) {
cursor.next = cursor.next.next;
} else {
cursor = cursor.next;
}
}
return head;
}
}
| Web Proxy Viewer | New URL | Original Page |