EVENTUAL -getting WA

https://www.codechef.com/viewsolution/35800422 .
i use map to get the freq of each character of a string.
can’t figured out on which test case it is lagging.

Consider this testcase
1
8
aaaabbbc

1 Like

Consider a scenario where the flag value on the 36th line of your solution is updated to 0. In the next iteration, if the frequency is ODD, then you print NO and break the loop and the flag value is not updated. So, an extra YES will be printed for that test case.

Example:
1
4
aabc
The expected output is:
NO
Your output is:
NO
YES

I made small changes to your code and it got accepted.

Your code with slight modification

1 Like

thanks.