Easy to understand || Runtime 0 ms Beats 100.00% || JAVA 
IntuitionSkip over the duplicate nodesApproachUse two pointers, one for previous non duplicate node and one for skipping the nodes.
Skip the current node while
# Intuition
Skip over the duplicate nodes
# Approach
Use two pointers, one for previous non duplicate node and one for skipping the nodes.
Skip the current node while next node value is same as current node value(Here we use the head node for skipping).
And update the next pointer of the prev node with the next non duplicate node.
# Complexity
- Time complexity:
O(n)

- Space complexity:
O(1)

# Code
```java []
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode deleteDuplicates(ListNode head) {
        if (head == null || head.next == null) return head;

        ListNode res = new ListNode(0,head);
        ListNode prev = res;

        while(head != null && head.next != null){
            if(head.next.val == head.val){
                while(head.next != null && head.next.val == head.val){
                    head = head.next;
                }
                prev.next = head.next;
            }else{
                prev = prev.next;
            }
            head = head.next; 
        }
        return res.next;
    }
}
```
['Java']