Find the K-Beauty of a Number
<-E 2269> Find the K-Beauty of a Number
class Solution {
public:
int divisorSubstrings(int num, int k) {
string strAns = to_string(num);
int n = strAns.size(),ans=0;
for (int i = 0; i < (n-k+1); i++){
if(stoi(strAns.substr(i, k)) != 0)
if(!(num % stoi(strAns.substr(i, k))))
ans++;
}
return ans;
}
};