We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Stack<Integer> stack = new Stack<>();
while(llist != null) {
stack.push(llist.data);
llist = llist.next;
}
for (int i = 0; i < positionFromTail; i++) {
stack.pop();
}
// The top of the stack is now the desired node
return stack.pop();
Cookie support is required to access HackerRank
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 →