Skip to content

Practice Count Substrings With K-Frequency Characters I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3325
LeetCode Problem

Count Substrings With K-Frequency Characters I

Problem Statement

Given a string s and an integer k, return the total number of substrings of s where at least one character appears at least k times.

Source: Count Substrings With K-Frequency Characters I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "abacb", k = 2
Output
4

# Example 2

Input
s = "abcde", k = 1
Output
15

Constraints

1 <= s.length <= 3000
1 <= k <= s.length
s consists only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Count Substrings With K-Frequency Characters I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.