You are viewing a single comment's thread. Return to all comments →
JS
let map = {} let max = 2 a.forEach(item => { if (map[item]) map[item]++ else { map[item] = 1 } }) Object.entries(map).forEach(([key, val]) => { const total = map[key] + (map[key - 1] || 0) if(total > max) max = total }) return max
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
JS