We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Can any one help me to check the issue. iam not able pass some of test cases with larger input. please hlp me out
static int superDigit(long l)
{
if (l == 0)
return 0;
return (int)((l % 9 == 0) ? 9 : (l % 9));
}
static long getDigit(String in, int k)
{
long res = 0;
for(int i=0;i<in.length();i++)
res=res*10+in.charAt(i)-'0';
return Math.abs(res*k);
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Can any one help me to check the issue. iam not able pass some of test cases with larger input. please hlp me out static int superDigit(long l) { if (l == 0)
return 0; return (int)((l % 9 == 0) ? 9 : (l % 9));