/*
* public class ListNode {
* int val;
* ListNode next = null;
* }
*/
public class Solution {
/**
*
* @param head ListNode类
* @return ListNode类
*/
public ListNode deleteDuplicates (ListNode head) {
// write code here
if(head == null || head.next == null){
return head;
}
ListNode currentNode = head;
while(currentNode != null){
ListNode next = currentNode.next;
if(next != null &¤tNode.val == next.val){
ListNode temp = next.next;
currentNode.next = temp;
}else{
currentNode = next;
}
}
return head;
}
}