双指针

/**
  * 
  * @param head ListNode类 
  * @return ListNode类
*/
func deleteDuplicates( head *ListNode ) *ListNode {
    // write code here
    if head == nil {
        return head
    }

//  双指针
    slow, fast := head, head.Next
    for fast != nil {
//      双指针值相同,则慢指针指向快指针
        if slow.Val == fast.Val {
            slow.Next = fast.Next
        }else{
//         否则向后滑动
            slow = slow.Next
        }

        fast = fast.Next
    }

    return head
}