JAVA || 2 SOLUTIONS || EXPLAINED
```\n// 1. In one traversal : using slow and fast pointer\n/\ntake two pointer slow and fast\n- fast will move n position forwards\n- now move forwards slow and
```\n// 1. In one traversal : using slow and fast pointer\n/*\ntake two pointer slow and fast\n- fast will move n position forwards\n- now move forwards slow and fast both, till fast not reach to end of LL\n- after performing upper operations, slow will reach to the previous node to the node which we want to delete\n*/\nclass Solution {\n    public ListNode removeNthFromEnd(ListNode head, int n) {\n        \n        ListNode slow = head, fast = head;\n        \n        // move fast n position forwards\n        while(n != 0){\n            fast = fast.next;\n            n--;\n        }\n        \n        // now move slow and fast both till fast not reach to end of LL\n        while(fast != null && fast.next != null){\n            fast = fast.next;\n            slow = slow.next;\n        }\n        \n        // if fast is null, its mean we want to delete head node\n        if(fast == null) return head.next;\n        \n        // remove node\n        slow.next = slow.next.next;\n        \n        return head;\n    }\n}\n\n\n// 2. In two traversal\nclass Solution {\n    public ListNode removeNthFromEnd(ListNode head, int n) {\n        \n        // find length\n        int len = 0;\n        ListNode temp = head;\n        while(temp != null){\n            temp = temp.next;\n            len++;\n        }\n        \n        if(len == n) return head.next;\n        \n        // Reach to the previous node of the last node\n        temp = head;\n        n = len-n-1;\n        while(temp.next != null && n != 0){\n            temp = temp.next;\n            n--;\n        }\n        \n        // remove \n        if(temp.next != null)\n            temp.next = temp.next.next;\n        \n        \n        return head;\n    }\n}
['Two Pointers', 'Java']