Saturday, November 19, 2011

Given a string of lowercase characters, reorder them such that the same characters are at least distance d from each other.


Input: { a, b, b }, distance = 2
Output: { b, a, b }

No comments :