Find a special number in an array

后端 未结 9 1684
天命终不由人
天命终不由人 2020-12-25 09:07

There are many numbers in an array and each number appears three times excepting for one special number appearing once. Here is the question: how can I find the special numb

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 09:47

    I got a solution. It's O (n) time and O (1) space.

    n=list(map(int,input().split()))
    l=[0]*64
    for x in n:
        b=bin(x)[2:]
        b='0'*(64-len(b))+b
        i=0
        while i

提交回复
热议问题