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 6ab0783 commit 31a903dCopy full SHA for 31a903d
count-ways-to-build-good-string/index.kt
@@ -1,6 +1,6 @@
1
package com.github.masx200.leetcode_test.count_ways_to_build_good_string
2
3
-const val mod = 1e9 + 7;
+const val mod = (1e9 + 7).toInt();
4
5
class Solution {
6
fun countGoodStrings(low: Int, high: Int, zero: Int, one: Int): Int {
@@ -10,8 +10,8 @@ class Solution {
10
for (i in 1..high) {
11
if (i >= zero) dp[i] += dp[i - zero];
12
if (i >= one) dp[i] += dp[i - one];
13
- dp[i] = (dp[i] % mod).toInt();
14
- if (i >= low) ans = ((ans + dp[i]) % mod).toInt();
+ dp[i] = (dp[i] % mod);
+ if (i >= low) ans = ((ans + dp[i]) % mod);
15
}
16
return ans;
17
0 commit comments