Tap here to switch tabs
Problem
Submissions

Problem: Remove Adjacent Almost-Equal Characters

Remove Adjacent Almost-Equal Characters asks you to change as few letters as possible so no neighboring characters are identical or alphabetically adjacent.

Statement

You are given a string word.

Two characters are considered almost equal if they are the same or adjacent in the alphabet. For instance, 'a' and 'b' are almost equal, and 'a' and 'a' are almost equal.

In one operation, you can change any character in word to any lowercase English letter.

Return the minimum number of operations required so that word contains no adjacent almost equal characters.

Constraints:

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

  • word consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove Adjacent Almost-Equal Characters

Remove Adjacent Almost-Equal Characters asks you to change as few letters as possible so no neighboring characters are identical or alphabetically adjacent.

Statement

You are given a string word.

Two characters are considered almost equal if they are the same or adjacent in the alphabet. For instance, 'a' and 'b' are almost equal, and 'a' and 'a' are almost equal.

In one operation, you can change any character in word to any lowercase English letter.

Return the minimum number of operations required so that word contains no adjacent almost equal characters.

Constraints:

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

  • word consists only of lowercase English letters.