fork download
  1. def findUnique(arr):
  2. c1=0
  3. c2=0
  4. for v in arr:
  5. carry = c1&v
  6. c1 ^= v
  7. c2 ^= carry
  8. threes = c1&c2
  9. c1 &= ~threes
  10. c2 &= ~threes
  11. return c1
  12.  
  13. print(findUnique([1,3,2,2,1,2,3,1,3,4]))
  14.  
Success #stdin #stdout 0.03s 63684KB
stdin
Standard input is empty
stdout
4