You are given an integer array nums, where each element is a single digit.
The triangular sum of nums is computed by executing the following procedure:
If nums has a length of nums[0].
Otherwise, construct a new integer array newNums of length nums.length
For every index i such that i nums.length newNums[i] = (nums[i] + nums[i + 1]) % % denotes the modulo operation.
Replace nums with newNums.
Repeat the process until only nums.
Return the triangular sum of nums.
Constraints:
nums.length
nums[i]
You are given an integer array nums, where each element is a single digit.
The triangular sum of nums is computed by executing the following procedure:
If nums has a length of nums[0].
Otherwise, construct a new integer array newNums of length nums.length
For every index i such that i nums.length newNums[i] = (nums[i] + nums[i + 1]) % % denotes the modulo operation.
Replace nums with newNums.
Repeat the process until only nums.
Return the triangular sum of nums.
Constraints:
nums.length
nums[i]