v2 time O(n) space O(1) Accepted

v1 failed to consider the case when n is the length of the list

v2 introduced dummy node to deal with this when head is removed