
[LeetCode] 19. Remove Nth Node From End of List, Medium
·
CodingTest/LeetCode
1. 문제연결 리스트와 정수 n이 주어질 때, n 번째 노드를 제외한 리스트를 반환하라.2. 해결/** * Definition for singly-linked list. * class ListNode { * val: number * next: ListNode | null * constructor(val?: number, next?: ListNode | null) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } * } */function removeNthFromEnd(head: ListNode | null, n: number): L..