Skip to content

Commit 3a1fab0

Browse files
authored
Update 136-single-number.js
1 parent 4c538f4 commit 3a1fab0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

136-single-number.js

+11
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,14 @@ const singleNumber = function(nums) {
77
for(let i = 1; i< nums.length; i++) xor ^= nums[i]
88
return xor
99
};
10+
11+
12+
// another
13+
14+
/**
15+
* @param {number[]} nums
16+
* @return {number}
17+
*/
18+
const singleNumber = function(nums) {
19+
return nums.reduce((ac, e) => ac ^ e, 0)
20+
};

0 commit comments

Comments
 (0)