Recursive Digit Sum

  • + 0 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));

    }
    
    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);
    }