You are given an integer array nums.
Each nums[i] is an encoded integer representing two positive integers xi and yi. To decode nums[i], define:
widthi = nums[i] % 10.di = floor(nums[i] / 10).xi as the integer formed by the first widthi digits of the decimal representation of di.yi as the integer formed by all remaining digits of the decimal representation of di.It is guaranteed that the decimal representation of di contains more than widthi digits. Therefore, both xi and yi contain at least one digit.
The decoded value of nums[i] is xiyi.
Return the sum of the decoded values of all elements in nums, modulo 109 + 7.
The floor() function returns the integer part of the division.
Example 1:
Input: nums = [231]
Output: 8
Explanation:
width = 1, d = 23, x = 2, and y = 3.23 = 8.nums, the sum of the decoded values is 8.Example 2:
Input: nums = [2522,2101]
Output: 1649
Explanation:
width = 2, d = 252, x = 25, and y = 2.252 = 625.width = 1, d = 210, x = 2, and y = 10.210 = 1024.625 + 1024 = 1649.Example 3:
Input: nums = [2301]
Output: 73741817
Explanation:
width = 1, d = 230, x = 2, and y = 30.230 = 1073741824.1073741824 modulo (109 + 7) = 73741817.Constraints:
1 <= nums.length <= 105100 < nums[i] < 10151 <= widthi <= 91 <= xi, yi < 109xi and yi do not have leading zeros.nums is a valid encoded integer.Loading editor...
[231]