Rearrange characters in a string such that no two adjacent are same - String programming
Rearrange characters in a string such that no two adjacent are same
Given a string with repeated characters, task is rearrange characters in a string so that no two adjacent characters are same.
Note : It may be assumed that the string has only lowercase English alphabets.
Examples:
Input: aaabc Output: abaca Input: aaabb Output: ababa Input: aa Output: Not Possible Input: aaaabc Output: Not Possible
http://www.interviewrack.com/2017/03/rearrange-characters-in-string-such_25.html