Pergunta de entrevista da empresa THG

Design a generic Linked List in Java. Follow up: given access only to the head of the list, return the middle element.

Resposta da entrevista

Sigiloso

12 de dez. de 2016

My answer was to first determine the length of the list and then go half the way. They suggested another approach, the slow and fast runner pointers. Both solutions would run in O(n) though.