358. Rearrange String k Distance Apart
Given a non-empty stringsand an integer k, rearrange the string such that the same characters are at least distance k from each other.
All input strings are given in lowercase letters. If it is not possible to rearrange the string, return an empty string""
.
Example 1:
Example 2:
Example 3:
Last updated
Was this helpful?