Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question

Interview Mountain View, CA

Find common node of two singly linked list given the heads

  of two nodes.

Interview Answer

1 Answer


find the length of two LL. Move the pointer in longer LL by difference(say if L1 - L2 = 3 then move pointer of L1 3 times once) for the 1st time and then increment each pointer one by one.

Interview Candidate on Dec 5, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.