Exactly 3 divisor
Time Limit Exceeded
class Solution
{
public int exactly3Divisors(int N)
{ int a=0;
for(int i=1 ; i<=N ;i++){
int count = 0;
int temp = count;
for(int j=1;j<=i;j++){
if(i%j==0){
temp++;
}
}
if(temp==3){
a++;
}
}
return a;
}
}
Comments
Post a Comment