Intel Corporation Interview Question

Given a linked list delete nth node from the last.

Interview Answer

Anonymous

Nov 4, 2023

use 2 pointers initially poointing to head of the linked list then using a for loop take one of the pointers to thenth node from there till the end of the linked list take both the pointers one at a time by the time one of the pointers reaches the end the other would have reached the nth node from the end.