package main
import . "nc_tools"


func removeNthFromEnd( head *ListNode ,  n int ) *ListNode {
    // write code here
    dummy := &ListNode{Next: head}
    fast, slow := head, dummy

    for i := 0; i < n; i++ {
        fast = fast.Next
    }

    for fast != nil {
        fast = fast.Next
        slow = slow.Next
    }
    slow.Next = slow.Next.Next

    return dummy.Next
}