You are viewing a single comment's thread. Return to all comments →
The C code another way to solve this problem 😁😎
int getNode(SinglyLinkedListNode* llist, int positionFromTail) { SinglyLinkedListNode* current=llist; int len=0,node=0; SinglyLinkedListNode* next; SinglyLinkedListNode* prev=NULL; while(current!=NULL) { next=current->next; current->next=prev; prev=current; current=next; } for(int i=0;i!=positionFromTail+1;i++) { node=prev->data; prev=prev->next; } return node; }
Seems like cookies are disabled on this browser, please enable them to open this website
Get Node Value
You are viewing a single comment's thread. Return to all comments →
The C code another way to solve this problem 😁😎