Company: Paypal__
Difficulty: medium
Array Construction Problem Description Given an array of n integers called required_sums, there is another array of n integers called result that can be constructed to meet the following conditions: - The values are non-decreasing, i.e., `result[i] ≤ result[j]` for `i required_sums)` where `required_sums` is an array of `n` integers representing the required sums of the digits. Returns `int`: the number of arrays that satisfy the constraints, modulo `(10^9 + 7)` Examples Example 1: Detailed Explanation There are `n = 3` elements with the required sums of digits, `required_sums = [30, 31, 3]`. These are the arrays that satisfy the conditions: - `result = [4998, 4999, 4999]` - `result = [4899, 4999, 4999]` - `result = [4899, 4999, 4999]` - `result = [3999, 4999, 4999]` For instance, consider `result = [4998, 4999, 4999]`. - `4998 ≤ 4999 ≤ 4999`, it satisfies the first constraint. - For the second constraint, - The sum of digits of `result[1] = 4 + 9 + 9 + 8 = 30 = required_sums[1]` - `4