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.
functiongetNode(llist,positionFromTail){// Write your code hereletaux=llist;letarrayAux=[],valueDesired=0,auxCont=0;while(aux!==null){arrayAux.push(aux.data);aux=aux.next;}if(arrayAux.length===1){returnarrayAux[0];}else{for(leti=arrayAux.length-1;i>=0;i--){if(auxCont===positionFromTail){valueDesired=arrayAux[i];}auxCont++;}returnvalueDesired;}}
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 →
I share my solucion in node.js Javascript