Tap here to switch tabs
Problem
Submissions

Problem: Count Substrings Divisible By Last Digit

Count Substrings Divisible By Last Digit asks you to count nonempty substrings whose numeric value is divisible by their final digit, excluding substrings ending in zero.

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

Count Substrings Divisible By Last Digit asks you to count nonempty substrings whose numeric value is divisible by their final digit, excluding substrings ending in zero.

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.