Count All Valid Pickup and Delivery Options
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 pickup(i).
Since the answer may be too large, return it modulo 10^9 + 7.
Example 1
Input
n = 1Output
1Unique order
(P1, D1), so Delivery 1 is always after Pickup 1.Example 2
Input
n = 2Output
6There are 6 valid orders;
(P1, D2, P2, D1) is invalid because Pickup 2 is after Delivery 2.Constraints
- 1 <= n <= 500