[At career fair] Reverse a linked list with O(1) space
Anonymous
Node temp=new Node() //Add a fake head temp->next=head; head=temp; Node curr=head while curr!=null and curr->next!=null Node next=curr->next; curr->next=next->next; next->next=head->next; head->next=next; return head->next;
Check out your Company Bowl for anonymous work chats.