You are viewing a single comment's thread. Return to all comments →
JS:
function gamingArray(arr) { const getMaxIdx = (maxIdx)=>{ let max = 0; for (let i = 0; i < maxIdx; i++){ if (arr[i] > max) max = arr[i]; } return arr.indexOf(max); } let cnt = 0; let idx = arr.length; while (idx > 0){ idx = getMaxIdx(idx); cnt++; } return (cnt%2 === 0) ? 'ANDY' : 'BOB' }
Seems like cookies are disabled on this browser, please enable them to open this website
Gaming Array 1
You are viewing a single comment's thread. Return to all comments →
JS: