Calculate Digit Sum of a String Solution Java
class Solution {\n  public String digitSum(String s, int k) {\n    while (s.length() > k) {\n      StringBuilder sb = new StringBuilder();\n      for (int i = 0
class Solution {\n  public String digitSum(String s, int k) {\n    while (s.length() > k) {\n      StringBuilder sb = new StringBuilder();\n      for (int i = 0; i < s.length(); i += k) {\n        int sum = 0;\n        for (int j = i; j < Math.min(s.length(), i + k); ++j)\n          sum += s.charAt(j) - \'0\';\n        sb.append(sum);\n      }\n      s = sb.toString();\n    }\n    return s;\n  }\n}\n
['String', 'Simulation']