Size of linked list is not given here. Below is the generic logic
Distance from head to K and A to END is same.
Step 1 in the image describes the first if condition :
if (nCurrentElement - NthNode == 0 ) {
pNthNode = Head;
}
//pNthNode = NewPointer
Step 2 in the image describes elseif condition :
else if ( nCurrentElement - NthNode > 0){
pNthNode = pNthNode ->pNext;
}
By the end of for loop NewPointer is the Nth node from end.