Most easy to understand


#1

int Solution::isPower(int A) {
int fac=1,sq,b=A;
sq=sqrt(A);
if (sqsq==A) return 1;
for(int i=2;i<=sq;i++){
if(A%i==0){
fac=i;
break;
}
}
b=A/fac;
sq=sqrt(b);
if(sq
sq==b) return 1;
return 0;
}


#2

why’s your solution working can you explain it ?


#3

your code is not working for 216.