+ 6
Rearrange a string so that all same characters become d distance away
Given a string and a positive integer d. Some characters may be repeated in the given string. Rearrange characters of the given string such that the same characters become d distance away from each other. Note that there can be many possible rearrangements, the output should be one of the possible rearrangements. If no such arrangement is possible, that should also be reported. Expected time complexity is O(n) where n is length of input string. Examples: Input: "abb", d = 2 Output: "bab"
3 Respuestas
+ 4
I'm working on it
+ 3
where is your code
0
i would have ansawerd but sadly could understand