Given a string str and an integer k, you need to rearrange the string in a way that the same characters must be at least k distance away. If not possible, return "".
Example1:
Input:
str = "aabb", k = 2
Output:
You can return either "abab" or "baba".
Example2:
Input:
str = "aaaa", k = 2
Output:
return ""
Copyright © A++ Code Bootcamp 2023