Company: PayPal SWE Intern_30oct
Difficulty: medium
Array Construction Problem Description Given an array of 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[i+1] . The sum of digits of result[i] == required_sums[i] for every i <= n . result[i] is <= 5000, for every i <= n . Find the number of distinct ways that result can be constructed to satisfy the constraints. Since the answer can be large, compute it modulo (10 9 + 7). Note: Two arrays a and b of length n are distinct if a[i] is not equal to b[i] for at least one i in 1 <= i <= n . Example: There are n = 3 elements with the required sum of digits, required_sums = [30, 31, 30] . These are the arrays that satisfy the conditions. result = [4998, 4999, 4999] result = [4989, 4999, 4999] result = [4899, 4999, 4999] result = [3999, 4999, 4999] For instance, consider result = [4998, 4999, 4999] . 4998 <= 4999 <= 4999 ,