Bit Manipulation - Single Number (XOR Self-Cancellation)
Identify the subtle bug in the following XOR-based single number code snippet:
def singleNumber(nums):
result = nums[0]
for num in nums:
result ^= num
return result
15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions