度小满笔试

  • 不知道有多少人是被那个内推贴骗了,内推过筛免笔试?不存在的。。。
  • 笔试是不可能做笔试的,这辈子都不会做笔试的(真香)好未来这种sb公司的笔试我都做了两次,并且依然没有收到面试,没办法,零offer选手就是这么卑微
  • A了1.91,第二题不知道卡了哪个用例,想了一会想不出来直接交了,有老哥知道的麻烦告知下,下面附代码

1、涂色

public class test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        char[] chars1 = str1.toCharArray();
        char[] chars2 = str2.toCharArray();
        int res = 0;
        HashMap<Character,Integer> map = new HashMap<Character, Integer>();
        for (int i = 0;i < chars1.length;i++)
        {
            if (map.containsKey(chars1[i]))
                map.put(chars1[i],map.get(chars1[i])+1);
            else
                map.put(chars1[i],1);
        }
        for (int i = 0;i < chars2.length;i++)
        {
            if (map.containsKey(chars2[i]))
            {
                if (map.get(chars1[i]) == 1)
                    map.remove(chars1[i]);
                else
                    map.put(chars1[i],map.get(chars1[i])-1);
                res++;
            }
        }
        System.out.println(res);
    }
}

2、相似字符串

public class test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String q = sc.nextLine();
        for(int i = 0;i < n;i++)
        {
            String str = sc.nextLine();
            String[] strs = new String[str.length()/3];
            boolean res = true;
            int z = 0;
            for (int m = 0;m < str.length();m = m + 3)
            {
                strs[z++] = str.substring(m,m+3);
            }
           // printString(strs);
            for (int x = 0;x < strs.length;x++)
            {
                for (int y = x+1;y < strs.length;y++){
                    if (!isValid(strs[x],strs[y]))
                        res = false;
                }

            }
            if (res)
                System.out.println("Yes");
            else
                System.out.println("No");
        }


    }
//    public static void printString(String[] strs)
//    {
//        for (String str : strs)
//            System.out.print(str +" ");
//        System.out.println();
//    }
    public static boolean isValid(String str1,String str2)
    {
        int dif = 0;
        for (int i = 0;i < 3;i++)
        {
            if (str1.charAt(i) != str2.charAt(i))
                dif++;
        }
        return dif < 2;
    }
}

#笔试题目##度小满#
全部评论
第一题,第二个循环找的key不应该是chars2吗?
1 回复
分享
发布于 2020-09-21 16:43
为什么我们第二题不一样? 我是java开发岗
点赞 回复
分享
发布于 2020-09-20 21:38
联易融
校招火热招聘中
官网直投
是不是双重for循环没跳出,超时,跟你代码差不多,A了。
点赞 回复
分享
发布于 2020-09-20 21:47
第一题5分钟做完一次A,第二题做了50多分钟9%,难受
点赞 回复
分享
发布于 2020-09-20 22:09
可能ACB,ABD也是有两个字母相同的,没有限制连一起好像
点赞 回复
分享
发布于 2020-09-21 01:23
第一批的确免笔试的😂估计他有时间限制,官网也没说清楚
点赞 回复
分享
发布于 2020-09-21 21:53
我确实免笔试了。。
点赞 回复
分享
发布于 2020-09-23 01:05
收到笔试了吗
点赞 回复
分享
发布于 2020-09-24 16:03

相关推荐

头像
点赞 评论 收藏
转发
2 6 评论
分享
牛客网
牛客企业服务