Skip to content

Practice Find the Count of Monotonic Pairs I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3250
LeetCode Problem

Find the Count of Monotonic Pairs I

Problem Statement

Given a positive integer array nums of length n, count pairs of length-n nonnegative integer arrays arr1 and arr2 such that arr1 is nondecreasing, arr2 is nonincreasing, and arr1[i] + arr2[i] equals nums[i] at every index. Return the count modulo 10^9 + 7.

Source: Find the Count of Monotonic Pairs I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,3,2]
Output
4

# Example 2

Input
nums = [5,5,5,5]
Output
126

Constraints

1 <= n == nums.length <= 2000
1 <= nums[i] <= 50

Related LeetCode Problems

Practice more problems similar to Find the Count of Monotonic Pairs I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.