题解 | #二维数组中的查找#

二维数组中的查找

https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e

public class Solution {
    public boolean Find(int target, int [][] array) {
        int i = array.length - 1, j = 0, maxj = array[0].length - 1;
        while(i >= 0 && j <= maxj){
            if(array[i][j] == target){
                return true;
            }else if (array[i][j] > target){
                i--;
            }else{
                j++;
            }
        }

        return false;
    }
}

#学习##刷题##每日刷题#
全部评论

相关推荐

程序员小白条:可以,技术栈别写太多,因为学院本这块,没必要太多,项目的话可以提前,技术栈放最下面,要么技术栈放最前面,多准备下八股文
点赞 评论 收藏
分享
03-15 10:59
已编辑
美团_后端开发(实习员工)
爱写代码的菜code...:哎,自己当时拿到字节offer的时候也在感叹终于拿到了,自己当时最想去的企业就是字节,结果还是阴差阳错去了鹅厂。祝uu一切顺利!!!
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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