1
var singleNumber = function (nums) {
2
let s = 0; // Location of first possible suspect
3
for (let i = s + 1; i < nums.length; i++) {
4
if (nums[i] == nums[s]) {
5
// If we found a duplicate
6
nums.splice(i, 1); // Remove duplicate so it won't confuse us next time we come across it
7
s++; // Next suspect's location
8
i = s; // Start of next search (i=s+1 in next loop iteration)
9
}
10
}
11
return nums[s];
12
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0