#3448

Count Substrings Divisible By Last Digit

hard · 23% accepted · 78 likes · top 3%

string · dynamic programming

⊣ practice⊣ open on leetcode ↗

Description

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.

Solution