3 ms·
If you remove the duplicates from the string: CACB You can get either CAB or ACB. If you were to order all of the possible results of removing duplicates (in
by grahamburger 7y ago
If you remove the duplicates from the string:
CACB
You can get either CAB or ACB. If you were to order all of the possible results of removing duplicates (in this case only two, but obviously many more for more complex strings) and order them alphabetically, then take the lowest one, that would be the right answer.