Practice Count Complete Substrings
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
Count nonempty contiguous substrings of word in which every character that occurs appears exactly k times, and the alphabet positions of every two adjacent characters differ by at most 2.
Source: Count Complete Substrings on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
word = "igigee", k = 2
Output
3
# Example 2
Input
word = "aaabbbccc", k = 3
Output
6
Constraints
1 <= word.length <= 10^5
word consists only of lowercase English letters.
1 <= k <= word.length
Related LeetCode Problems
Practice more problems similar to Count Complete Substrings.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.