sqrt(N) solution using property of log


#1

nt Solution::isPower(int A) {

    for(int i=1;i<=sqrt(A);i++)
    {
        if(float(log(A)/log(i))==int(log(A)/log(i)))
        {
            return 1;
        }
    }
    return 0;

}