Practice Remove Adjacent Almost-Equal Characters
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed string word. In one operation, you can pick any index i of word and change word[i] to any lowercase English letter. Return the minimum number of operations needed to remove all adjacent almost-equal characters from word. Two characters a and b are almost-equal if a == b or a and b are adjacent in the alphabet.
Source: Remove Adjacent Almost-Equal Characters on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
word = "aaaaa"
2
# Example 2
word = "abddez"
2
# Example 3
word = "zyxyxyz"
3
Constraints
Related LeetCode Problems
Practice more problems similar to Remove Adjacent Almost-Equal Characters.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.