This is my codes for kata (4 kyu) "Large Factorials". It worked fine when I tested them on CodeLite and (https://www.onlinegdb.com/online_c++_compiler). But it give a wrong answer when I test them on codewars online.
std::vector<int> prdv(nv1.size() + nv2.size());
for ( int i=0; i < (int)nv1.size(); i++) {
for (int j=0; j < (int)nv2.size(); j++){
prdv[i+j] += nv1[i] * nv2[j];
}
}
//mutilplication of int vetor (no carry). The order is a reverse.
for (int i=0; i < (int)prdv.size(); i++){
int lf;
int rm;
lf = prdv[i]%10;
rm = prdv[i]/10;
prdv[i] = lf;
prdv [i+1] += rm;
}
if (prdv[prdv.size()-1] == 0) {
prdv.pop_back();
}
//carry mutilple digits in one element to next ones.
return prdv;
This is my codes for kata (4 kyu) "Large Factorials". It worked fine when I tested them on CodeLite and (https://www.onlinegdb.com/online_c++_compiler). But it give a wrong answer when I test them on codewars online.
include
include
include
std::vector ntov (int num) {
std:: vector nvec;
std::string nstr = std::to_string(num);
return nvec; }
std::vector LnMulti (std::vector nv1, std::vector nv2){
}
}
}