Skip to content

Commit 53e79c9

Browse files
authored
Create 1359-count-all-valid-pickup-and-delivery-options.kt
1 parent 5279fa1 commit 53e79c9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
fun countOrders(n: Int): Int {
3+
var slots = 2 * n
4+
var res = 1L
5+
val mod = 1_000_000_007
6+
7+
while (slots > 0) {
8+
val choices = (slots * (slots - 1) % mod) / 2
9+
res = (res * choices) % mod
10+
slots -= 2
11+
}
12+
13+
return res.toInt()
14+
}
15+
}

0 commit comments

Comments
 (0)