PayPal interview question

reverse Linked List

Interview Answers

Anonymous

3 Apr 2012

gave a recursive solution, but was not satisfied with my answer

Anonymous

20 Mar 2016

ListNode reverse(ListNode head) { ListNode newHead = null; while(head != null) { ListNode nextNode = head.next; head.next = newHead; newHead = head; head = nextNode; } return newHead; }