My issue
time limit exceeded. What to do?
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t,n,m,c=0,max=0,p;
cin>>t;
while(t--){
cin>>n;
for(int i =2;i<=n;i++){
if(n%i==0){
m=n/i;
for(int j=1;j<=m;j++){
if(m%j==0){
c++;
}
}
if(c>max){
max=c;
p=i;
}}
c=0;
}
cout<<p<<endl;
}
}
Learning course: 2000 to 2500 difficulty problems
Problem Link: Maximum Factors Problem Practice Problem in 2000 to 2500 difficulty problems - CodeChef