Back to DSA
Reorganize String
mediumRearrange the characters of a given string so that no two neighboring characters are identical. If such a rearrangement is impossible, return an empty string.
Examples
Example 1:
Input:
s = "bbac"Output:
"babc" Example 2:
Input:
s = "aaaa"Output:
""Hints
1234567