Skip to content

Commit 0925768

Browse files
Create 1359-count-all-valid-pickup-and-delivery-options.java
1 parent f69cf77 commit 0925768

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public int countOrders(int n) {
3+
int MOD = (int) 1e9 + 7;
4+
int slots = 2*n;
5+
long res = 1;
6+
7+
while(slots > 0){
8+
int valid_choices = slots*(slots - 1)/2;
9+
res = (res * valid_choices) % MOD;
10+
slots -= 2;
11+
}
12+
return (int)res;
13+
}
14+
}

0 commit comments

Comments
 (0)