mediumGreedyString 0 views

String Without AAA or BBB

Given two integers a and b, return any string s such that:

Given two integers a and b, return any string s such that:

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"

Constraints

  • 0 <= a, b <= 100
  • It is guaranteed such an s exists for the given a and b.

Hints

No hints yet.

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.