Leetcode 3448. Count Substrings Divisible By Last Digit

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.

Company

Level All Levels

Region All Regions

Company

Filters 0

Leetcode 3448. Count Substrings Divisible By Last Digit | Hello Interview