Created
January 13, 2020 21:56
-
-
Save amejiarosario/8bc62de6e63e45ef81467a84e8469a9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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