标签:
题目描述:public class Solution {
public bool SearchMatrix(int[,] matrix, int target)
{
var rowLen = matrix.GetLength(0);
var colLen = matrix.GetLength(1);
var row = rowLen - 1;
var col = 0;
while(col <= colLen - 1 && row >= 0){
if(matrix[row,col] == target){
return true;
}
else if(matrix[row,col] < target){
col ++;
}
else{
row --;
}
}
return false;
}
}LeetCode -- Search a 2D Matrix II
标签:
原文地址:http://blog.csdn.net/lan_liang/article/details/49962513