All contents and pictures on this website come from the Internet and are updated regularly every week. They are for personal study and research only, and should not be used for commercial purposes. Thank you for your cooperation.
Given two integers A
and B
, return any string
S
such that:
S
has length A + B
and contains exactly A
'a'
letters, and exactly B
'b'
letters;
- The substring
'aaa'
does not occur in S
;
- The substring
'bbb'
does not occur in S
.
Example 1:
Input: A = 1, B = 2
Output: "abb"
Explanation: "abb", "bab" and "bba" are all correct answers.
Example 2:
Input: A = 4, B = 1
Output: "aabaa"
Difficulty:
Medium
Lock:
Normal
All contents and pictures on this website come from the Internet and are updated regularly every week. They are for personal study and research only, and should not be used for commercial purposes. Thank you for your cooperation.