Class Solution
-
- All Implemented Interfaces:
public final class Solution767 - Reorganize String.
Medium
Given a string
s, rearrange the characters ofsso that any two adjacent characters are not the same.Return any possible rearrangement of
sor return""if not possible.Example 1:
Input: s = "aab"
Output: "aba"
Example 2:
Input: s = "aaab"
Output: ""
Constraints:
1 <= s.length <= 500sconsists of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final StringreorganizeString(String s)-
-
Method Detail
-
reorganizeString
final String reorganizeString(String s)
-
-
-
-