阿里5.28的笔试有人做了吗?第一题我这样写怎么不对啊?

public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String num = in.nextLine();  int n = Integer.parseInt(num);  if(n<1 || n>100000){  return;
    }
    String s = in.nextLine();
    String t = in.nextLine();  if(s.length() != n || t.length() != n){ return ;
    }  int res = getResult(n, s, t);
    System.out.println(res);
} private static int getResult(int n, String s, String t) {  int res = 0;  char[] chars = s.toCharArray();  char[] chart = t.toCharArray();  for(int i=0; i<n; i++){  if(chars[i] != chart[i]){
            res++;
        }
    }  return res;
}

#笔试题目##阿里巴巴#
全部评论
为什么改好格式了,发上来格式还是乱的
点赞 回复
分享
发布于 2021-05-28 20:19
职位是java开发实习
点赞 回复
分享
发布于 2021-05-28 20:23
联易融
校招火热招聘中
官网直投
题目呢
点赞 回复
分享
发布于 2021-05-28 23:34
交换的情况怎么没了
点赞 回复
分享
发布于 2021-05-29 13:08

相关推荐

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