Amazon Interview Question

To find nth node from the end in a singly linked list

Interview Answer

Anonymous

Dec 28, 2010

Have two pointers called headPointer, NthPointer. Move headPointer N times. Move both the pointer until headPointer hits null. NthPointer will point to Nth Node.

1