Tap here to switch tabs
Problem
Submissions

Problem: String Without AAA or BBB

med
30 min
Try to solve the String Without AAA or BBB problem.

Statement

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

  • s contains exactly a occurrences of the letter 'a' and b occurrences of the letter 'b'.

  • The substring 'aaa' does not appear in s.

  • The substring 'bbb' does not appear in s.

Constraints:

  • 0≤a,b≤1000 \le a, b \le 100

  • It is guaranteed that such a string s exists for the given a and b.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: String Without AAA or BBB

med
30 min
Try to solve the String Without AAA or BBB problem.

Statement

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

  • s contains exactly a occurrences of the letter 'a' and b occurrences of the letter 'b'.

  • The substring 'aaa' does not appear in s.

  • The substring 'bbb' does not appear in s.

Constraints:

  • 0≤a,b≤1000 \le a, b \le 100

  • It is guaranteed that such a string s exists for the given a and b.