Tap here to switch tabs
Problem
Submissions

Problem: Count Substrings Divisible By Last Digit

Try to solve the Count Substrings Divisible By Last Digit problem.

Statement

Given a string s consisting of digits, return the number of non empty substrings of s such that the numerical value represented by the substring is divisible by its last digit.

Note: A substring ending in '0' is not divisible by its last digit because division by 00 is undefined.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of digits only.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Substrings Divisible By Last Digit

Try to solve the Count Substrings Divisible By Last Digit problem.

Statement

Given a string s consisting of digits, return the number of non empty substrings of s such that the numerical value represented by the substring is divisible by its last digit.

Note: A substring ending in '0' is not divisible by its last digit because division by 00 is undefined.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of digits only.