leetcode——231—— Power of Two

来源:互联网 发布:微信支付 域名备案 编辑:程序博客网 时间:2024/06/05 20:30

Given an integer, write a function to determine if it is a power of two.

class Solution {public:    bool isPowerOfTwo(int x){        double data = log10(x)/log10(2);        return (data-(int)data==0)?true:false;            }};

0 0