Recall & Review
beginner Click to reveal answer
What does XOR operation do when applied between two identical bits?
XOR of two identical bits is 0. For example, 1 XOR 1 = 0 and 0 XOR 0 = 0.
beginner Click to reveal answer
Why does XOR help find the only non-repeating element in an array where every other element repeats twice?
Because XOR of a number with itself is 0, all repeating elements cancel out, leaving only the non-repeating element after XORing all elements.
beginner Click to reveal answer
What is the initial value used when XORing all elements to find the unique element?
The initial value is 0 because XOR with 0 leaves the number unchanged, so it does not affect the result.
beginner Click to reveal answer
How does the XOR operation behave when applied between a number and 0?
XOR of any number with 0 is the number itself. For example, 5 XOR 0 = 5.
beginner Click to reveal answer
What is the time complexity of finding the only non-repeating element using XOR in an array?
The time complexity is O(n), where n is the number of elements, because we XOR all elements once.
What is the result of XORing a number with itself?
✗ Incorrect
XOR of a number with itself is always 0.
What initial value should you use when XORing all elements to find the unique element?
✗ Incorrect
Start with 0 because XOR with 0 does not change the value.
If an array has elements [2, 3, 2, 4, 3], what is the unique element using XOR?
✗ Incorrect
XORing all elements cancels duplicates, leaving 4.
What is the time complexity of the XOR method to find the unique element?
✗ Incorrect
We iterate once over the array, so time complexity is O(n).
Which of these is NOT true about XOR operation?
✗ Incorrect
XOR of two different numbers is not always 1; it depends on their bits.
Explain how XOR helps find the only non-repeating element in an array where every other element repeats twice.
Think about how pairs cancel each other out using XOR.
You got /4 concepts.
Describe the steps and time complexity of the XOR method to find the unique element in an array.
Focus on the iteration and XOR properties.
You got /4 concepts.
