#3251
Find the Count of Monotonic Pairs II
international master · 2110 · lc hard +32 · 24.6% accepted · 102 likes · top 4%
Description
You are given positive integer array nums of length n. Count pairs (arr1, arr2) where 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 modulo 109 + 7.
Code
1
2
3