How to check if a given number is a power of two?

前端 未结 5 883
说谎
说谎 2020-12-01 16:23

The code below isn\'t working right for some inputs.

a, i = set(), 1
while i <= 10000:
    a.add(i)
    i <<=         


        
5条回答
提交回复
热议问题