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
correct ans = AAAAB
correct ans = ABCDE
correct ans = AAB
correct ans = ABCDD
For the case :
correct ans should be ABDCD
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.
Thanks a lot.I was not considering this testcases. @shivam217
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