Tap here to switch tabs
Problem
Submissions

Problem: Find the K-Beauty of a Number

med
30 min
Try to solve the Find the K-Beauty of a Number problem.

Statement

The kk beauty of an integer num is defined as the number of substrings of num, when viewed as a string, that satisfy the following conditions:

  • The substring has a length equal to k.

  • The integer value represented by the substring divides num evenly.

Return the kk beauty of num.

Note:

  • Leading zeros in substrings are permitted.

  • The value 00 is not a divisor of any integer.

  • Substrings may overlap.

Constraints:

  • 1≤1 \leq num ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq num.length (taking num as a string)

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the K-Beauty of a Number

med
30 min
Try to solve the Find the K-Beauty of a Number problem.

Statement

The kk beauty of an integer num is defined as the number of substrings of num, when viewed as a string, that satisfy the following conditions:

  • The substring has a length equal to k.

  • The integer value represented by the substring divides num evenly.

Return the kk beauty of num.

Note:

  • Leading zeros in substrings are permitted.

  • The value 00 is not a divisor of any integer.

  • Substrings may overlap.

Constraints:

  • 1≤1 \leq num ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq num.length (taking num as a string)