Professional Documents
Culture Documents
Given an integer K and a numeric string str (all the characters are from the range [‘0’, ‘9’]).
The task is to count the number of sub-strings of str that are divisible by K.
Example:
Input: str = “33445”, K = 11
Output: 3
Sub-strings that are divisible by 11 are “33”, “44” and “3344”
Input: str = “334455”, K = 11
Output: 6