QUESTION
Write a function that receives as input the head node of a linked list an integer
k.Your function should remove the kth node from the end of the linked list and return the head node of the updated list.
EXAMPLE LINKED LIST
(20) -> (19) -> (18) -> (17) -> (16) -> (15) -> (14) -> (13) -> (12) -> (11) -> null
Head node would refer to the node (20). Let k = 4, so it should remove the 4th node of the list, node (14).
The new list should have node (14) removed from it.
CODE
const linkedList = node => {
let head = node;
}
I'm not sure how to go about this. I define a function with node as a parameter and I need to be able to differentiate each node and be able to traverse through and remove the one in question.
Any starter tips or pointers?