231 Power of Two

这个题如果面试拿出来就是要录你了 哈哈

class Solution:
    # @param {integer} n
    # @return {boolean}
    def isPowerOfTwo(self, n):
        return n == pow(2, len(bin(n)) - 3)

 

posted @ 2015-07-06 08:35  dapanshe  阅读(86)  评论(0编辑  收藏  举报