【leetcode】Search a 2D Matrix
来源:互联网 发布:东方网络何时复牌 编辑:程序博客网 时间:2024/05/29 11:20
class Solution {public: bool searchMatrix(vector<vector<int> > &matrix, int target) { // Note: The Solution object is instantiated only once and is reused by each test case. int m=matrix.size(); int n=matrix[0].size(); int row=0,col=n-1;//右上角的节点 while(row<m&&col>=0)//O(m+n) { if(matrix[row][col]==target) return true; else if(matrix[row][col]<target) row++; else if(matrix[row][col]>target) col--; } return false; }};
- [leetcode][Search] Search a 2D Matrix
- LeetCode: Search a 2D Matrix
- LeetCode Search a 2D Matrix
- [Leetcode] Search a 2D Matrix
- LeetCode : Search a 2D Matrix
- [LeetCode] Search a 2D Matrix
- Leetcode 74 Search a 2D Matrix
- leetcode 90: Search a 2D Matrix
- [LeetCode]Search a 2D Matrix
- [Leetcode] Search a 2-D matrix
- [Leetcode]Search a 2D Matrix
- [leetcode]Search a 2D Matrix
- LeetCode-Search a 2D Matrix
- [leetcode] Search a 2D Matrix
- LeetCode - Search a 2D Matrix
- LeetCode:Search a 2D Matrix
- LeetCode 74: Search A 2D Matrix
- leetcode之Search a 2D Matrix
- MySQL循环语句生成数据
- 关于WinRT中c++和c#相互调用的问题
- 关于涉及链表和数组中信息交换的一些思考
- windows8 认识及使用
- 程序员的梦想
- 【leetcode】Search a 2D Matrix
- 点在三角形ABC内 之二 (三维坐标系)
- Android-SDK无法更新的问题解决
- POJ 1364
- C++静态构造函数的实现
- 分享生活感悟的经典句子
- C++变态题汇总
- ubuntu安装kscope
- bash脚本函数中无法访问脚本参数的问题