adding code for calculating max sum with no adjacent elements and max size square submatrix