Simple 6-line Java one-pass solution
public class Solution {\n\n    public ListNode removeNthFromEnd(ListNode head, int n) {\n        ListNode start=new ListNode(0),slow=start,fast=start;\n        
public class Solution {\n\n    public ListNode removeNthFromEnd(ListNode head, int n) {\n        ListNode start=new ListNode(0),slow=start,fast=start;\n        start.next=head;\n        for(int i=0;i<n;i++) fast=fast.next;\n        while(fast.next!=null) {fast=fast.next;slow=slow.next;}\n        slow.next=slow.next.next;\n        return start.next;\n    }\n}
[]