Skip to content

Instantly share code, notes, and snippets.

View renatoalencar's full-sized avatar
🍵
Smashing the stacks

Renato Alencar renatoalencar

🍵
Smashing the stacks
View GitHub Profile
async function findMostFrequent(array, blackListArr)
{
if(array.length == 0)
return null;
var modeMap = {};
var maxEl = array[0], maxCount = 1;
// First go through blackList array and set maxEl to the first element that isn't in the blacklist, if every of the numbers in the array is in the blacklist, then just return generateRandom
var containsValidNumbers = false;