Company: Amex_23july
Difficulty: medium
Construct Longest String Without Forbidden Substrings Problem Description There are two-letter strings, "AA", "AB" and "BB", which appear AA , AB and BB times respectively. The task is to join some of these strings to create the longest possible string which does not contain "AAA" or "BBB". For example, having AA = 5, AB = 0 and BB = 2, it is possible to join five strings by taking both of the "BB" strings and three of the "AA" strings. Then they can be joined into "AA-BB-AA-BB-AA" which becomes "AABBAABBAA". Note that it is not possible to add another "AA" string as the result would then contain "AAA". Write a function: class Solution { public String solution(int AA, int AB, int BB); } that, given three integers AA , AB and BB , returns the longest string that can be created according to the rules described above. If there is more than one possible answer, the function may return any of them. In your solution, focus on correctness. The performance of your solution will not be the focu