Discuss / Java / 作业打卡

作业打卡

Topic source

看了大家的写法,感觉我这么写太low了

static int findMissingNumber(int start, int end, List<Integer> list) {
        Integer num = 0;
        for(Integer n=start; n<=end; n++) {
            Boolean f = false;
            for(Integer m : list) {
                if(n.equals(m)) {
                    f = true;
                }
            }
            if(f.equals(false)) {
                num = n;
                break;
            }
        }
        return num;
    }

  • 1

Reply