Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function singleNumber(nums) {
for (let i = 0; i < nums.length; i++) {
let found = false;
for (let j = 0; j < nums.length; j++) {
if (nums[j] === nums[i] && i != j) {
found = true;
break;
}
}
if (!found) return nums[i];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment