package
Version:
v1.6.3
Opens a new window with list of versions in this module.
Published: May 30, 2020
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
< Previous
Next >
Given a string S
, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.
If possible, output any possible result. If not possible, return the empty string.
Example 1:
Input: S = "aab"
Output: "aba"
Example 2:
Input: S = "aaab"
Output: ""
Note:
S
will consist of lowercase letters and have length in range [1, 500]
.
[Heap]
[Greedy]
[Sort]
[String]
Similar Questions
- Rearrange String k Distance Apart (Hard)
- Task Scheduler (Medium)
Hints
Hint 1
Alternate placing the most common letters.
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.