Search
⌘K

Leetcode 3251. Find the Count of Monotonic Pairs II

Count the number of pairs of non-negative integer arrays (arr1, arr2) of length n with arr1 non-decreasing, arr2 non-increasing, and arr1[i]+arr2[i]=nums[i] for all i — equivalently, count non-decreasing sequences a[i] with 0 ≤ a[i] ≤ nums[i] such that nums[i]-a[i] is non-increasing. Return the total count modulo 10^9+7 (n ≤ 2000, nums[i] ≤ 1000).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.