/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) { val = x; }
 * }
 */
public class Solution {
    public ListNode removeNthFromEnd(ListNode head, int n) {
    	if(head == null)	return head;
    	
    	ListNode dummy = new ListNode(0);
    	dummy.next = head;
    	ListNode p1 = dummy, p2 = dummy;
    	for(; p1 != null && n >= 0; n--)
    		p1 = p1.next;
    	while(p1 != null) {
    		p2 = p2.next;
    		p1 = p1.next;
    	}
    	p2.next = p2.next.next;
    	return dummy.next;
    }
}

@@ -381,39 +381,21 @@
    %09
-for(; p1 != null && n
+while(n--
  %3E
-=
  0
-; n--
 )%0A  
@@ -428,16 +428,35 @@
 le(p1 !=
+ null && p1.next !=
  null) %7B

Update 019.java