Pergunta de entrevista da empresa Svitla Systems

Q: How to find if two linked lists have a common tail?

Resposta da entrevista

Sigiloso

13 de mai. de 2021

First find minimal length of the list and then skip first elements for the longest list to start iterating over two lists with equal number of remaining elements. If for any iterations pointers are the same, the lists have the common tail. If you reached the end of the list, then there is no common tail.