You are viewing a single comment's thread. Return to all comments →
function getNode(head, positionFromTail) {
const dict = {} let i=0 while(head){ dict[i] = head.data; i++ head=head.next } i=i-1; return dict[i-positionFromTail]
}
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 →
function getNode(head, positionFromTail) {
const dict = {} let i=0 while(head){ dict[i] = head.data; i++ head=head.next } i=i-1; return dict[i-positionFromTail]
}