Pergunta de entrevista da empresa Amazon

Find last K elements of a linked list.

Resposta da entrevista

Sigiloso

20 de mar. de 2013

Use 2 pointers that point to head at the start. increment one of them by k-1 Keep incrementing both until first pointer hits an end. there u have 2nd pointer pointing to the first element of the last K elements

1