Can be used at [interview]
-
https://xania.org/202512/01-xor-eax-eax
-
encryption part of the code, or some kind of sprite routine
mov eax, 0x0takes 5 stepsxor eax, eaxsets the eax register to 0- Used everywhere in the linux kernel
-
-
-
You are given an array of n - 1 integers which are in the range between 1 and n. All numbers appear exactly once, except one number, which is missing. Find this missing number.
-
The XOR trick: If we have a sequence of XOR operations a ^ b ^ c ^ ..., then we can remove all pairs of duplicated values without affecting the result.
-
a ^ b ^ c ^ a ^ b # Commutativity = a ^ a ^ b ^ b ^ c # Using x ^ x = 0 = 0 ^ 0 ^ c # Using x ^ 0 = x (and commutativity) = c - In-Place Swapping (without intermediary variable)
-
x ^= y y ^= x x ^= y - Finding the Missing Number
- Finding the Duplicate Number
-
You are given an array A of n + 1 integers which are in the range between 1 and n. All numbers appear exactly once, except one number, which is duplicated. Find this duplicated number.
-
- Finding Two Missing/Duplicate Numbers
-
-
-
nznrnfrfntjfmvfwmzdfjlvtqnbhcprsgWithin this string, you want to find the first W-character window in which every character is unique. - Give each letter a maskable unique integer bit
-