solution to removeNthFromEnd