A rearrangement is possible if and only if no character appears more than times where is string length. Why? In the best case, you alternate the most frequent character with others.
If it appears more than half the time, you cannot avoid adjacent duplicates. For "aab" (length ), max frequency is . Character 'a' appears twice, which is okay. For "aaab", 'a' appears times but max allowed is . Impossible.