-
[못품/릿코드/javascript] 19. Remove Nth Node From End of List카테고리 없음 2023. 3. 28. 12:28
var removeNthFromEnd = function(head, n) { let fast = head, slow = head; for(let i=0;i<n;i++){ fast = fast.next } if(!fast) return head.next while(fast.next){ fast = fast.next slow = slow.next } slow.next = slow.next.next return head };