Skip to content

Commit a67b79c

Browse files
committed
Update single-number-iii.cpp
1 parent 2ca73e5 commit a67b79c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

C++/single-number-iii.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Solution {
66
vector<int> singleNumber(vector<int>& nums) {
77
// Xor all the elements to get x ^ y.
88
int x_xor_y = accumulate(nums.cbegin(), nums.cend(), 0, bit_xor<int>());
9+
910
// Get the last bit where 1 occurs.
1011
x_xor_y &= -x_xor_y;
1112

0 commit comments

Comments
 (0)