Sometimes in interviews we are asked to not to use tail pointers, lets say to insert Nodes from last, then what should be the approach to all the questions where we have used tail pointer
Use of Tail pointer
For specifically this problem, you could keep 3 pointers on the LL. Swap using the first two and advance your pointers on the LL using the third pointer.
1 Like