We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a1a69a commit 3b36b65Copy full SHA for 3b36b65
src/main/java/g3101_3200/s3179_find_the_n_th_value_after_k_seconds/Solution.java
@@ -16,15 +16,12 @@ public int valueAfterKSeconds(int n, int k) {
16
private int combination(int a, int b) {
17
long numerator = 1;
18
long denominator = 1;
19
-
20
for (int i = 0; i < b; i++) {
21
numerator = (numerator * (a - i)) % mod;
22
denominator = (denominator * (i + 1)) % mod;
23
}
24
25
// Calculate the modular inverse of denominator
26
long denominatorInverse = power(denominator, mod - 2);
27
28
return (int) ((numerator * denominatorInverse) % mod);
29
30
0 commit comments