static int findMissingNumber(int start,int end,List list) { for (int j = start; j <= end; j++) { boolean hint=false; for (Object i:list) { if (i.equals(j)) { hint=true; } } if(!hint){ return j; } } return -1; }
Sign in to make a reply
康208970
static int findMissingNumber(int start,int end,List list) {
for (int j = start; j <= end; j++) {
boolean hint=false;
for (Object i:list) {
if (i.equals(j)) {
hint=true;
}
}
if(!hint){
return j;
}
}
return -1;
}