Intersection of two linked lists
Anonymous
My solution: Node getIntersect(Node headA,Node headB){ if(headA==null||headB==null) return null; Node first=headA,second=headB; while(first!=second){ first=(first==null)?headB:first.next; second=(second==null)?headA:second.next; } return first; }
Check out your Company Bowl for anonymous work chats.