Show my cpp solution without loop and recurtion


  • 0
    Z
    class Solution {
    public:
    bool isPowerOfFour(int num) {
    
        if(num<0)
    		return 0;
    	double re;
    	re = log(num)/log(4);
    	if(re == (int)re)
    		return 1;
    	return 0;
    }
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.