You are viewing a single comment's thread. Return to all comments →
there is no need to declare current : Java Solution :
int GetNode(Node head,int n) { Node result = head; int i = 0; while(head != null) { head = head.next; if(i++ > n) { result = result.next; } } return result.data;
}
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 →
there is no need to declare current : Java Solution :
int GetNode(Node head,int n) { Node result = head; int i = 0; while(head != null) { head = head.next; if(i++ > n) { result = result.next; } } return result.data;
}