1417. Reformat The String
https://leetcode.com/problems/reformat-the-string
Description
Given alphanumeric string s
. (Alphanumeric string is a string consisting of lowercase English letters and digits).
You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same type.
Return the reformatted string or return an empty string if it is impossible to reformat the string.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
1 <= s.length <= 500
s
consists of only lowercase English letters and/or digits.
ac
Last updated