3 ms·
The interviewer probably learned the trick with two pointers and wanted to see you implement it, for no real reason. This question, just like it's well-known si
by ventana 2mo ago
The interviewer probably learned the trick with two pointers and wanted to see you implement it, for no real reason. This question, just like it's well-known sibling question "check if the linked list has a loop", has absolutely no practical applicability; no one will ever want to find k-th element from the end of the linked list, it's just not the right data structure for this kind of task: it's better to use an array or a double linked list if you need to do this operation often.