/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 *
 * @param nums int整型一维数组
 * @return int整型
 */
function minNumberDisappeared(nums) {
    // write code here
    if (!nums.length) {
        return null;
    }

    let sort = nums.sort((a, b) => {
        return a - b;
    });
    console.log(sort)
    if (sort[0] > 1) {
        return 1;
    }
    for (let i = 0; i < sort.length - 1; i++) {
        if(sort[i+1]<=0){continue}
        if(sort[i+1] - sort[i] > 1){
            if (sort[i+1]==1){continue}
            return sort[i+1]-1
        }
    }
    return sort[sort.length-1]+1
}
module.exports = {
    minNumberDisappeared: minNumberDisappeared,
};