-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
int solve(int b){
num.clear();
while(b>0){
num.push_back(b%10);
b/=10;
}
reverse(num.begin(), num.end());
/// Stored all the digits of b in num for simplicity
memset(DP, -1, sizeof(DP));
int res = call(0, 0, 0);
cout<<res<<endl;
return res;
}
modified code for memset
int solve(int a,int b){
memset(dp,-1,sizeof(dp));
vector digitA;
getDigit(a-1,digitA);
int ans1=getData(digitA.size()-1,0,1,digitA);
vector digitB;
getDigit(b,digitB);
int ans2=getData(digitB.size()-1,0,1,digitB);
return ans2-ans1;
}
Metadata
Metadata
Assignees
Labels
No labels