Discuss / Java / 找出从start到end的缺失的数字并返回

找出从start到end的缺失的数字并返回

Topic source

/**

* TODO: 找出从start到end的缺失的数字并返回

*/

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

int i = 0;

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

if(list.contains((Object)i)==false) {

break;

}

}

return i;

}

if(!list.contains(i)) {

break;

}

abc

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

直接作弊了,属于是,哈哈哈


  • 1

Reply