RemoveNthNodeFromEnd - Definition for singly-linked list public class ListNode cfw int val ListNode next ListNode(int x cfw val = x next = null public

RemoveNthNodeFromEnd - Definition for singly-linked list...

This preview shows page 1 out of 1 page.

/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public class RemoveNthNodeFromEnd { public ListNode removeNthFromEnd(ListNode head, int n) { ListNode nd = head; ListNode head1 = head; if(head == null){ return null; }else if(head.next == null){
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Spring '14

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes