Implemented the nth last node problem