Amazon interview question

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

Interview Answer

Anonymous

28 Dec 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