Remove nth node from last position in linked list
You failed to solve the "try to do this in one pass" part, as you iterate through the list once to find the total size and a second time to find the nth element from the start.

The algorithmic idea is, to use two pointers into the list:


Initialize poiner1 to head, advance n times (if n is the distance from the tail you seek)
Then, initialize pointer2 to head, advance both pointers, until pointer1 is null, i.e. reached the end of the list.
Now, pointer2 should point to the end-nth element


Removal as usual.