思路:从右上角元素开始查找(即mat[0][m-1]),假设必能找到,若x=该元素,直接返回;若x>该元素,则列不变,行+1;否则行不变,列-1. class Solution: def findElement(self, mat, n, m, x): return self.find(mat, 0, n, 0, m, x) def find(self, mat, i, n, j, m, x): if x == mat[i][m-1-j]: return [i, m-1-j] elif x > mat[i][m-1-j]: ...