My simple Java solution in one pass
 public ListNode removeNthFromEnd(ListNode head, int n) {\n        ListNode dummy=new ListNode(0);\n        dummy.next=head;\n        ListNode fast=dummy;\n    
     public ListNode removeNthFromEnd(ListNode head, int n) {\n        ListNode dummy=new ListNode(0);\n        dummy.next=head;\n        ListNode fast=dummy;\n        ListNode slow=dummy;\n        int temp=n;\n        for(;fast.next!=null;temp--){\n            if(temp<=0){ //control\n                slow=slow.next;\n            }\n            fast=fast.next;\n        }\n        slow.next=slow.next.next;//delete Nth\n        return dummy.next;\n    }
[]