#3250

Find the Count of Monotonic Pairs I

candidate master · 1500 · lc hard +32 · 47.5% accepted · 153 likes · top 32%

Description

You are given positive integer array nums of length n. A pair (arr1, arr2) is monotonic if both have length n, arr1 is non-decreasing, arr2 is non-increasing, and arr1[i] + arr2[i] == nums[i] for all i.

Return the count of monotonic pairs modulo 109 + 7.

Code

1
2
3