#3756

Concatenate Non-Zero Digits and Multiply by Sum II

expert · 1175 · lc medium +32 · 24.1% accepted · 70 likes · top 3%

Description

Given a digit string s of length m and a 2D integer array queries where each queries[i] = [li, ri], for each query extract the substring s[li..ri], build integer x by joining its non-zero digits in order (or x = 0 if none exist), compute x multiplied by the sum of digits of x, and return all results modulo 109 + 7.

Code

1
2
3