Tap here to switch tabs
Problem
Submissions

Problem: Minimum Additions to Make Valid String

med
30 min
Try to solve the Minimum Additions to Make Valid String problem.

Statement

Given a string word containing only the letters "a", "b", and "c", return the minimum number of characters that must be inserted into word to make it valid.

A string is considered valid if it can be formed by concatenating the string "abc" one or more times.

Constraints:

  • 1≤1 \leq word.length ≤50\leq 50

  • word consists of letters "a", "b", and "c" only.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Additions to Make Valid String

med
30 min
Try to solve the Minimum Additions to Make Valid String problem.

Statement

Given a string word containing only the letters "a", "b", and "c", return the minimum number of characters that must be inserted into word to make it valid.

A string is considered valid if it can be formed by concatenating the string "abc" one or more times.

Constraints:

  • 1≤1 \leq word.length ≤50\leq 50

  • word consists of letters "a", "b", and "c" only.