Given the head of a linked list, remove the nth node from the end of the list and return the head of the modified list.
The input linked list is represented as an array.
nInput: [1,2,3,4,5] 2 Output: [1,2,3,5]
Input: [1] 1 Output: []
Input: [1,2] 1 Output: [1]
Your program must print the final linked list as a JSON array.
print(str(fuctionname(x)).replace(" ", ""))
No submissions yet.
Discuss two-pointer technique, dummy node usage, and single-pass optimization.