Skip to content

Practice Find the K-Beauty of a Number

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

Easy#2269
LeetCode Problem

Find the K-Beauty of a Number

Problem Statement

Read num as decimal digits. Count length-k contiguous substrings whose integer values are nonzero divisors of num. Leading zeros within a substring are allowed, and occurrences at different positions count separately. Return that count.

Source: Find the K-Beauty of a Number on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = 240, k = 2
Output
2

# Example 2

Input
num = 430043, k = 2
Output
2

Constraints

1 <= num <= 10^9
1 <= k <= num.length (taking num as a string)

Related LeetCode Problems

Practice more problems similar to Find the K-Beauty of a Number.

Review your practice with PhantomCodeAI

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