Jonathan-Uy / CSES-Solutions

Accepted Solutions to the CSES Competitive Programming Problem Set
511 stars 166 forks source link

Update Palindrome Reorder.cpp #11

Closed AvivBlattner closed 1 year ago

AvivBlattner commented 2 years ago

Support odd > 1

Jonathan-Uy commented 1 year ago

Your change gives an incorrect output for AABBC. One correct answer is ABCBA, however, your program outputs ABCCBA.

In my code, odd represents the character which appears an odd number of times, with 0 for A, and 25 for Z. I am only printing the character once on Line 30, since the other freq[odd] - 1 times are accounted for in the loops before and after it.