2745. Construct the Longest New String
You are given three integers
x,y, andz.You have
xstrings equal to"AA",ystrings equal to"BB", andzstrings equal to"AB". You want to choose some (possibly all or none) of these strings and concactenate them in some order to form a new string. This new string must not contain"AAA"or"BBB"as a substring.Return the maximum possible length of the new string.
A substring is a contiguous non-empty sequence of characters within a string.
1 | class Solution { |