Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created January 13, 2020 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amejiarosario/8bc62de6e63e45ef81467a84e8469a9f to your computer and use it in GitHub Desktop.
Save amejiarosario/8bc62de6e63e45ef81467a84e8469a9f to your computer and use it in GitHub Desktop.
function hasDuplicates(n) {
const duplicates = [];
let counter = 0; // debug
for (let outter = 0; outter < n.length; outter++) {
for (let inner = 0; inner < n.length; inner++) {
counter++; // debug
if(outter === inner) continue;
if(n[outter] === n[inner]) {
return true;
}
}
}
console.log(`n: ${n.length}, counter: ${counter}`); // debug
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment