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.
because u won't know where is the tail until u iterate a whole LinkedList. if we have a length 5 list and want to get positionFromTail 2, we will go this way:
4 3 2 1 0 1 2
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 →
because u won't know where is the tail until u iterate a whole LinkedList. if we have a length 5 list and want to get positionFromTail 2, we will go this way: 4 3 2 1 0 1 2