Svitla Systems interview question

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

Interview Answer

Anonymous

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.