Longest String Without AAA or BBB

Problem Overview

  • Build the longest string by concatenating given counts of "AA", "AB", and "BB" without forming "AAA" or "BBB".
  • Input: integers AA, AB, BB in [0..10]; Output: any longest valid non-empty string.
  • Real-world domain: constrained string construction/sequence building, typical in a coding interview.
  • Multiple valid results allowed; return any longest one.
  • From Zolando interviews; a classic interview question and string problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: