Tap here to switch tabs
Problem
Submissions

Problem: Remove Adjacent Almost-Equal Characters

med
30 min
Try to solve the Remove Adjacent Almost-Equal Characters problem.

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

med
30 min
Try to solve the Remove Adjacent Almost-Equal Characters problem.

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.