Discuss / Java / 随机

随机

Topic source

I WILL.

#1 Created at ... [Delete] [Delete and Lock User]

static int findMissingNumber(int start, int end, List<Integer> list) {

int count = 0;

Integer[] array = list.toArray(Integer[]::new);

for (int i = start; i <= end; i++) {

for (int s : array) {

if (s == i) {

count = 0;

break;

} else if (s != i && count!=list.size()-1) {

count++;

continue;

} else if (s != i && count==list.size()-1){

return i;

}

}

}

return 0;

}


  • 1

Reply