题解 | #缺失数字#

缺失数字

http://www.nowcoder.com/practice/9ce534c8132b4e189fd3130519420cde

/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 找缺失数字
 * @param a int整型一维数组 给定的数字串
 * @param aLen int a数组长度
 * @return int整型
 */
int solve(int* a, int aLen ) {
    // write code here
    int i=0;
    while(i<=aLen){
        if(i++!=*a++)
        return i-1;
    }
    return 0;
}
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务