← All problemsSign in

3448. Count Substrings Divisible By Last Digit

LeetCodeStringDynamic ProgrammingOpen on judge ↗

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. Example 1: Input: s = "12936" Output: 11 Explanation: Substrings "29", "129", "293" and "2936" are not divisible by their last digit. There are 15 substrings in total, so the answer is 15 - 4 = 11. Example 2: Input: s =

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start