My one pass solution
public ListNode RemoveNthFromEnd(ListNode head, int n) {\n        ListNode h1=head, h2=head;\n        while(n-->0) h2=h2.next;\n        if(h2==null)return head.
    public ListNode RemoveNthFromEnd(ListNode head, int n) {\n        ListNode h1=head, h2=head;\n        while(n-->0) h2=h2.next;\n        if(h2==null)return head.next;  // The head need to be removed, do it.\n        h2=h2.next;\n        \n        while(h2!=null){\n            h1=h1.next;\n            h2=h2.next;\n        }\n        h1.next=h1.next.next;   // the one after the h1 need to be removed\n        return head;\n    }
[]