Given a string, rearrange characters of the string such that no duplicate characters are adjacent to each other. For example, Input: aaabc Output: abaca Input: aa Output: No valid output Input: aaaabc Output: No valid output How can we achieve this rearrangement? The very first idea that may pop up is to count the frequency […]