2950. Number of Divisible Substrings
Hash TableStringCountingPrefix Sum
Hints
Hint 1
Iterate over all substrings in
O(n * n).Hint 2
For each substring, try to calculate the sum of the mapped values in
O(1).Hint 3
To do the above, use a partial sum array.
Preparing judge…