You are given an array of positive integers nums of length n.
A pair of nonnegative integer arrays (arr1, arr2) of length n is called monotonic if for every index i such that i
arr1[i] + arr2[i] nums[i]
arr1 is monotonically nondecreasing (that is, arr1[i] arr1[i + 1] for all i
arr2 is monotonically nonincreasing (that is, arr2[i] arr2[i + 1] for all i
Return the total number of valid monotonic pairs. Since the answer may be very large, return it modulo
Constraints:
n nums.length
nums[i]
You are given an array of positive integers nums of length n.
A pair of nonnegative integer arrays (arr1, arr2) of length n is called monotonic if for every index i such that i
arr1[i] + arr2[i] nums[i]
arr1 is monotonically nondecreasing (that is, arr1[i] arr1[i + 1] for all i
arr2 is monotonically nonincreasing (that is, arr2[i] arr2[i + 1] for all i
Return the total number of valid monotonic pairs. Since the answer may be very large, return it modulo
Constraints:
n nums.length
nums[i]