Skip to content

Commit c425323

Browse files
authored
Update minimum-flips-to-make-a-or-b-equal-to-c.py
1 parent 8b1286f commit c425323

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Python/minimum-flips-to-make-a-or-b-equal-to-c.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def number_of_1_bits(n):
1616
result += 1
1717
return result
1818

19-
diff = (a|b)^c
20-
return number_of_1_bits(diff) + number_of_1_bits(diff & (a&b))
19+
return number_of_1_bits((a|b)^c) + number_of_1_bits(a&b&~c)
2120

2221

2322
# Time: O(31)

0 commit comments

Comments
 (0)