Amazon Online Assessment (OA) - Longest String Without 3 Consecutive Characters

Given A, B, C, find any string of maximum length that can be created such that no 3 consecutive characters are the same. There can be at max A 'a', B 'b', and C 'c'.

Examples

Example 1:

Input:A = 1, B = 1, C = 6
Output: ccbccacc

Example 2:

Input:A = 1, B = 2, C = 3
Output: acbcbc

Try it yourself


Got a question?ย Ask the Teaching Assistantย anything you don't understand.

Still not clear? Ask in the Forum, ย Discordย orย Submitย the part you don't understand to our editors.

โ†
โ†‘TA ๐Ÿ‘จโ€๐Ÿซ