Guest User

(Firebase) Delete a List's Tail Node

a guest
Jan 9th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. public ListNode deleteAtTail(ListNode head) {
  2.  
  3. if(head == null || head.next == null) return null;
  4. ListNode curr = head;
  5.  
  6. while(curr.next.next != null){
  7. curr = curr.next;
  8. }
  9. curr.next = null;
  10. return head;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment