Partially accepted on ARTBALAN

https://www.codechef.com/viewsolution/22969492

The maximum number of distinct characters in English alphabet is 26 ,You should limit the number of distinct characters to 26 .then it will give AC.
The value of your variable “occur” should not exceed 26.

could you give me the snippet where to change? Thanks.

int ans = INT_MAX;
for(auto i:factors){
int occur = n/i;
if(occur<=26){
int tmp[26] = {0},
idx=0;
while(occur–){
tmp[(idx++)%26] = i;
}
int res=0;
for(int i=0;i<26;i++){
if(freq[i]>tmp[i]){
res += freq[i] - tmp[i];
}
}
ans = min(ans,res);
}
}

Now everyone knows @andrew1234 :smiley:

Wow man. That really did give me an AC. Thanks a ton.