C++/代码:
class Solution { public: bool Find(int target, vector<vector<int> > array) { if (array.empty() || array[0].empty()) return false; int i = 0, j = array[0].size() - 1; while (i < array.size() && j >= 0) { if (array[i][j] == target) { return true; break; } else if (array[i][j] < target) i++; else j--; } return false; } };