Skip to content

Commit

Permalink
Update bit_manipulation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaShkaruba authored Aug 28, 2023
1 parent a8a7777 commit a200818
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/algorithms/bit_manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ For example, let's say that we were concerned only about the 2nd bit (0 indexed

More about XOR:
- An easy way to think about XOR: if you do `x XOR 0`, then nothing changes with `x`. If you do `x XOR 1`, then `x` is flipped. It works both ways, so `1 XOR x` flips x, and `0 xor X` doesn't.
- If you xor a value with another value twice, nothing changes `X XOR 12345 XOR 12345 = X`, because all the bits that need to be flipped, will be flipped twice and become the same thgey were.
- If you xor a value with another value twice, nothing changes `X XOR 12345 XOR 12345 = X`, because all the bits that need to be flipped, will be flipped twice and become the same thgey were. This [problem](https://leetcode.com/problems/single-number/) can be solved with this rule.

0 comments on commit a200818

Please sign in to comment.