Question: java code for this problem We consider alphabet with only three letters: a, b and c A string is called diverse if no three consecutive

 java code for this problem We consider alphabet with only three

java code for this problem

We consider alphabet with only three letters: "a", "b" and "c" A string is called diverse if no three consecutive letters are the same. In other words, a diverse string may not contain any of the strings "aaa", "bbb" or "ccc". Write a function: class Solution { public string solution (int A, int B, int C); } that, given three integers A, B and C, returns any longest possible diverse string containing at most A letters 'a', at most B letters 'b' and at most C letters 'c'. If there is no possibility of building any string, return empty string. Examples: 1. Given A = 6, B = 1 and C = 1, your function may return "aabaacaa". Note that "aacaabaa would also be a correct answer. Your function may return any correct answer. ? 2. Given A = 1, B = 3 and C = 1 your function may return "abbcb", "bcbab", "bacbb" or any of several other strings

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!