http://www.codechef.com/viewsolution/6570234
Can anyone please explain where my solution is failing. I can’t figure it out myself.
You are getting wrong answers for these test cases
5
AABAA
correct ans = AAAAB
6
ABCDE
correct ans = ABCDE
3
BAA
correct ans = AAB
5
ADBCD
correct ans = ABCDD
See [here][1].
[1]: EgiVPI - Online C++ Compiler & Debugging Tool - Ideone.com
3 Likes
For the case :
5
ADBCD
correct ans should be ABDCD
1 Like
for the test case DABC your code will give ans ADBC but the correct ans would be
ABCD (by moving D to the end)
what error are you getting ?
Dont know… I am checking my solution with some testcases and also the AC solutions.Both are giving same result.Still WA.
your welcome
1 Like
bro, if we pick “D” and move it last position then we will get “ABCDD” and “ABCDD” is lexicographically smaller than “ABDCD” .
oh yes…sorry my bad