Pregunta de entrevista de Svitla Systems

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

Respuesta de la entrevista

Anónimo

13 may 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.