0984. String Without AAA or BBB
https://leetcode.com/problems/string-without-aaa-or-bbb
Description
Given two integers a
and b
, return any string s
such that:
s
has lengtha + b
and contains exactlya
'a'
letters, and exactlyb
'b'
letters,The substring
'aaa'
does not occur ins
, andThe substring
'bbb'
does not occur ins
.
Example 1:
Example 2:
Constraints:
0 <= a, b <= 100
It is guaranteed such an
s
exists for the givena
andb
.
ac
Last updated