Skip to content

Practice Count All Valid Pickup and Delivery Options

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

Hard#1359
LeetCode Problem

Count All Valid Pickup and Delivery Options

Problem Statement

Given n orders, each order consists of a pickup and a delivery service. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7.

Source: Count All Valid Pickup and Delivery Options on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 1
Output
1

# Example 2

Input
n = 2
Output
6

# Example 3

Input
n = 3
Output
90

Constraints

1 <= n <= 500

Related LeetCode Problems

Practice more problems similar to Count All Valid Pickup and Delivery Options.

Review your practice with PhantomCodeAI

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