Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created December 30, 2015 16:02
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 chuck0523/9b15f1b88ba817838fc7 to your computer and use it in GitHub Desktop.
Save chuck0523/9b15f1b88ba817838fc7 to your computer and use it in GitHub Desktop.
var visited = [];
var isUnique = function(n) {
return visited.indexOf(n) === -1;
};
for(var i = 1; i <= num; i += 1) {
if(isUnique(input[i])) {
uniqueNums += 1;
} else {
visited.push(input[i]);
}
}
console.log(uniqueNums);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment