第一题: 大佬看一下哪里错了 public static int dfs(String s, int current) {         if (current == s.length()) {             return 0;         }         int max = 0;         for (int i = current; i < s.length(); i++) {             int a = Integer.parseInt(s.substring(current, i + 1));             if (a % 3 == 0) {                 max = Math.max(max, dfs(s, i + 1) + 1);             } else {                 max = Math.max(max, dfs(s, i + 1));             }         }         return max;     }
点赞 2

相关推荐

点赞 评论 收藏
分享
牛客网
牛客企业服务