Microsoft Phone Interview

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-03-26Added By Anonymous
Source: Link

Given an input string of size 2n, consisting of letter's "a" and "b" only, generate all the different permutation. Input string will always be even size and the number of "a" and "b" will be n.

Eg:

input: "aabb"

output: aabb,abab,abba,bbaa,baba,baab ...

input:"ab"

output: "ab","ba";

input: "aaabbb"

output: ...

Comments