@xpfxzxc No, not O(n), you can't just ignore m.

Even if you assume that the input is a quadratic matrix, you're creating non-quadratic subproblem matrices, as your last example shows. So your statement "In every recursion, the matrix is uniformly divided into 4 parts" isn't really true, and "T(N) = 2T(N/2)" isn't really valid.

That said, a proper analysis might indeed show that it's O(N) if the input matrix has size N×N. After all, LeetCode's article looks at the two extremes of this algorithm and ends up with "O(n)" in one and "O(lg n)2" in the other.