As reported: eBay MTS1, virtual DSA round 1 (2026): an append-only transaction log contains one fraudulent transaction whose position is known counting from the end; the log may be traversed at most once; remove it. (This is removing the n-th node from the end of a linked list; it was coded.)
The log is a singly linked list, oldest transaction first. Given its head and n, remove the n-th node from the end and return the head. Traverse the list only once.
This is LeetCode 19 — Remove Nth Node From End of List.
Example 1
head = [1,2,3,4,5], n = 2 -> [1,2,3,5]
Example 2
head = [1], n = 1 -> []
Example 3
head = [1,2], n = 1 -> [1]
Constraints: 1 ≤ length ≤ 30; 0 ≤ Node.val ≤ 100; 1 ≤ n ≤ length.
Code runner format: one JSON value per line: the list as an array, then n. Implement removeNthFromEnd(head, n); the harness prints the resulting list.