Remove Nth Node From End of List
var removeNthFromEnd = function(head, n) {
if(!head.next) return null;
let prev = head;
let toDeleted = head;
let it = head;
let count = 1;
while(it.next){
it = it.next;
if(count >= n){
prev = toDeleted;
toDeleted = prev.next;
}
count++;
}
if(prev.next === toDeleted.next){
head = head.next;
return head;
}
prev.next = toDeleted.next
return head;
};