Question DSA-BIT-0061
HardWhat is the output of this code?
def single(a):
ones = twos = 0
for x in a:
ones = (ones ^ x) & ~twos
twos = (twos ^ x) & ~ones
return ones
print(single([2, 2, 3, 2]), single([0, 1, 0, 1, 0, 1, 99]))
- A.
3 1
- B.
0 99
- C.
3 99
- D.
2 99
Sign up free to see the answer and a step-by-step explanation.