parcels parcels to handle. Each parcel involves two events: the courier **picks it up** and later **drops it off**. All 2 · parcels events form one sequence.
A sequence is valid if every parcel is dropped off after it has been picked up. Count the valid sequences. The answer can be large, so return it modulo 10⁹ + 7.parcels=1 → 1
The only option is to pick the parcel up and then drop it off.
parcels=2 → 6
Write P for a pick-up and D for a drop-off. The valid orders are P1 P2 D1 D2, P1 P2 D2 D1, P1 D1 P2 D2, P2 P1 D1 D2, P2 P1 D2 D1 and P2 D2 P1 D1, 6 in total. P1 D2 P2 D1, for example, does not count: parcel 2 is dropped off before it is picked up.
parcels=4 → 2520
parcels=1
1
Run checks the first 3 tests in your browser. Submit checks all 35 tests on the server, hidden ones included.