Zalando | Berlin | online

727
May 12, 2023
May 12, 2023

I got one question which i am not able to solve-
Give occurences of AA, BB and AB strings. Find maximum length of string you can make with them without getting AAA or BBB in between.

Ex-
AA = 2
BB = 1
AB = 1

output -
ABAABBAA

can anyone let me know the approach and solution for this?

Comments (5)