Practice Count Substrings Divisible By Last Digit
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a string s consisting of digits. Return the number of substrings of s divisible by their non-zero last digit. Note: A substring may contain leading zeros.
Source: Count Substrings Divisible By Last Digit on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "12936"
Output
11
# Example 2
Input
s = "5701283"
Output
18
# Example 3
Input
s = "1010101010"
Output
25
Constraints
1 <= s.length <= 10^5
s consists of digits only.
Related LeetCode Problems
Practice more problems similar to Count Substrings Divisible By Last Digit.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.