Smallest solution ever!


#1
int Solution::isPower(int A) {
    if(A==1)
    return true;
    int flag=0;
    for(int i=2;i<=sqrt(A);i++){
        if(A%i==0){
            if((A/i)==i)
            return true;
            else if(isPower(A/i)&&(A/i)%i==0)
            return true;
        }
    }
    return false;
}

#2

why this condition was needed?