Count All Valid Pickup and Delivery Options

Given n orders, where each order consists of a pickup and a delivery, count all valid sequences of pickups and deliveries where each delivery occurs after its respective pickup. Return the answer modulo 10^9 + 7.

Constraints

  • 1 <= n <= 500
Saving… · 2 lines
class Solution:
def countValidPickupAndDeliveryOptions(self, n: int) -> int:
Console

Click Run to execute sample tests.