Finding the Nth-node-from-the-end of a linked list.
answer in my mind:
1. travel the linked list for n times (if you hit null in between, return null) 2. Then travel the linked list till end (remember to increment the n-node pointer along with traversal)
its very simple.. take two pointers p1,p2 start p2 after p1 has travelled 'n' nodes and let p1 travel upto last.the node pointed by p2 will be nth node from last