You are viewing a single comment's thread. Return to all comments →
instead of prepending to the array, you can also do this:
def GetNode(head, position): out = [] while head: out.append(head.data) head = head.next return out[-(position + 1)]
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 →
instead of prepending to the array, you can also do this: