fix: updated problem output since the numbers of combinations could be very high.

This commit is contained in:
2026-05-18 16:34:33 -03:00
parent c85571e157
commit c58f6e4aeb
10 changed files with 23 additions and 7 deletions

View File

@@ -3,6 +3,8 @@
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;
ll numDecodings(string s)
{
if (s[0] == '0')
@@ -20,12 +22,14 @@ ll numDecodings(string s)
if (current != '0')
{
next = dp2;
next %= MOD;
}
int code = stoi(aux);
if (10 <= code && code <= 26)
{
next += dp1;
next %= MOD;
}
swap(dp1, dp2);
swap(dp2, next);