Pergunta de entrevista da empresa eBay

Reverse a Linked List Algo for Binary tree Lowest Common Ancestor

Resposta da entrevista

Sigiloso

20 de out. de 2014

Recursive way to reverse a linked list. public static Node recursive(Node head){ if(head==null) return null; if(head.next==null) return head; Node second = head.next; head.next=null; Node reverse=recursive(second); second.next=head; return reverse; }