Search
⌘K

Leetcode 3448. Count Substrings Divisible By Last Digit

Count how many substrings of a digit string represent numbers divisible by their nonzero last digit. Because n ≤ 1e5, the solution must avoid O(n^2) and instead use modular arithmetic per ending digit (only 1–9) to efficiently count valid substrings using residues/powers of 10.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.