JuniorMath

Count the Digits That Divide a Number

Given an integer num, return the number of digits in num that divide num.

An integer val divides nums if nums % val == 0.

Example 1
Inputnum = 7
Output1
7 divides itself, hence the answer is 1.
Example 2
Inputnum = 121
Output2
121 is divisible by 1, but not 2, and since 1 occurs twice as a digit, we return 2.

Constraints

  • 1 <= num <= 10^9
  • num does not contain 0 as one of its digits.

Asked at 3 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate