Partially accepted on ARTBALAN

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;
int tmp[26] = {0},
tmp[(idx++)%26] = i;
int res=0;
for(int i=0;i<26;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.