判断二维数组中是否含有该整数

二维数组中的查找

http://www.nowcoder.com/questionTerminal/abc3fe2ce8e146608e868a70efebf62e

public boolean Find(int target, int [][] array) { boolean result = false; int count = array.length; for (int i=0;i<count;i++){ int num = array[i].length; for (int j=0;j<num;j++) { if(array[i][j]==target){
                result = true; return result;
            }
        }
    } return result;
}


全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务