using System;
using System.Collections.Generic;
class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param target int整型
* @param array int整型二维数组
* @return bool布尔型
*/
public bool Find (int target, List<List<int>> array) {
if(array.Count == 0 || array[0].Count == 0) return false;
int row = 0;
int col = array[0].Count - 1;
while(row <= array.Count - 1 && col >= 0){
if(array[row][col] < target) row++;
else if(array[row][col] == target) return true;
else col--;
}
return false;
}
}


京公网安备 11010502036488号