I think that all we need is
if (matrix.length == 0)
However, I saw some of them write
if (matrix == null || matrix.length == 0 || matrix[0].length == 0)
Is my version enough to check a matrix is empty or not or we need to write the above version?