We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aabf1d4 commit 75159d2Copy full SHA for 75159d2
single_number_II/single_number_II.go
@@ -3,11 +3,9 @@ package single_number_II
3
func singleNumber(nums []int) int {
4
var one, two, three int
5
for i := range nums {
6
- two |= one & nums[i]
7
- one ^= nums[i]
8
- three = one & two
9
- one &= ^three
10
- two &= ^three
+ three = two & nums[i]
+ two = ^three & (two | one&nums[i])
+ one = ^three & (one ^ nums[i])
11
}
12
return one
13
0 commit comments