Tap here to switch tabs
Problem
Submissions

Problem: Number of Divisible Substrings

Try to solve the Number of Divisible Substrings problem.

Statement

Each lowercase English letter is mapped to a number as follows:

  • 'a' and 'b' map to 11

  • 'c', 'd', and 'e' map to 22

  • 'f', 'g', and 'h' map to 33

  • 'i', 'j', and 'k' map to 44

  • 'l', 'm', and 'n' map to 55

  • 'o', 'p', and 'q' map to 66

  • 'r', 's', and 't' map to 77

  • 'u', 'v', and 'w' map to 88

  • 'x', 'y', and 'z' map to 99

A substring is called divisible if the sum of the mapped values of its characters is divisible by the length of the substring.

Given a string word, return the number of divisible substrings in word.

Constraints:

  • 1≤1 \leq word.length ≤2000\leq 2000

  • word consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Divisible Substrings

Try to solve the Number of Divisible Substrings problem.

Statement

Each lowercase English letter is mapped to a number as follows:

  • 'a' and 'b' map to 11

  • 'c', 'd', and 'e' map to 22

  • 'f', 'g', and 'h' map to 33

  • 'i', 'j', and 'k' map to 44

  • 'l', 'm', and 'n' map to 55

  • 'o', 'p', and 'q' map to 66

  • 'r', 's', and 't' map to 77

  • 'u', 'v', and 'w' map to 88

  • 'x', 'y', and 'z' map to 99

A substring is called divisible if the sum of the mapped values of its characters is divisible by the length of the substring.

Given a string word, return the number of divisible substrings in word.

Constraints:

  • 1≤1 \leq word.length ≤2000\leq 2000

  • word consists only of lowercase English letters.