gj.And here is my solution, beat 100% and I think it is easy to understand

if not matrix or not matrix[0]: return False
for i in range(len(matrix)):
if target==matrix[i][-1]: return True
elif target<matrix[i][-1]:
for j in range(len(matrix[0])):
if matrix[i][j]==target: return True
return False
return False

@lee215 I like the one-liner, though it has different complexity. In your other solutions I don't like the redefinition of m and n. The problem already defined them to be height and width of the matrix (as is the standard in math/compsci).

I am aware that this is not the optimum solution, I am just surprised that an O(m*n) time complexity solution is accepted. My questions raises a flag about the test suite used for the submissions -- it is not sufficiently well constructed.