Tap here to switch tabs
Problem
Submissions

Problem: Count Beautiful Substrings I

Try to solve the Count Beautiful Substrings I problem.

Statement

You are given a string s and a positive integer k.

Let vowels denote the number of vowels in a substring, and let consonants denote the number of consonants in that substring.

Vowels are the characters 'a', 'e', 'i', 'o', and 'u'. All other English lowercase letters are consonants.

A substring is considered beautiful if:

  1. vowels == consonants

  2. (vowels $ imes$ consonants) \\% k =0= 0

Return the total number of non empty beautiful substrings in s.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • 1≤1 \leq k ≤1000\leq 1000

  • s consists of only English lowercase letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Beautiful Substrings I

Try to solve the Count Beautiful Substrings I problem.

Statement

You are given a string s and a positive integer k.

Let vowels denote the number of vowels in a substring, and let consonants denote the number of consonants in that substring.

Vowels are the characters 'a', 'e', 'i', 'o', and 'u'. All other English lowercase letters are consonants.

A substring is considered beautiful if:

  1. vowels == consonants

  2. (vowels $ imes$ consonants) \\% k =0= 0

Return the total number of non empty beautiful substrings in s.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • 1≤1 \leq k ≤1000\leq 1000

  • s consists of only English lowercase letters.