Leetcode 2950. Number of Divisible Substrings
Count how many substrings of a given digit string represent base-10 numbers divisible by a given integer p. Solve by using modular arithmetic / rolling remainders (tracking prefix remainders with powers of 10, and handling small-special-case divisors like 2 or 5) to avoid constructing large integers and achieve linear-time counting.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.