can we use the doubly linked list it solve this problem
Kth elements from the last
you can do it without doubly linked list
Approach
Maintain two pointers – Fast and slow pointer.
Initialize both pointers to head.
First, move fast pointer to n nodes from head.
Now move both pointers one by one until the fast pointer reaches the end. Now the slow pointer will point to nth node from the end.
Return the slow pointer.
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course
1 Like