Help me out in this
yeah… having some internet issues just hold on 
Hey @shivammishra20121999
Please explain this
for(int i=1;i<=k;i++)
{
n=n+n;
}
Also u cant use atoi , see the constraints ,
Here also updted ur code
int calculate (long long int num) //updated long long
{
if(num>=0 && num<=9)
{
return num;
}
int sum=0;
int rem;
while(num>0)
{
rem=num%10;
sum+=rem;//upated this because digit sum
num=num/10;
}
return calculate(sum);//updated this sending sum
}
int superDigit(string n, int k) {
long long int num=0;//added this
for(int i=1;i<=n.length();i++) //updated n.lenght()
{
num+=n[i-1]-'0';//updated this: adding digits
}
num*=k; //added : k times concat
// int num=stoi(n);removed this
// cout<<num;
int res=calculate(num);
return res;
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.