Function to check if all elements present in descending diagonal starting from position ( i , j ) in the matrix are all same or not
def checkDiagonal ( mat , i , j ) : NEW_LINE INDENT res = mat [ i ] [ j ] NEW_LINE i += 1 NEW_LINE j += 1 NEW_LINE while ( i < N and j < M ) : NEW_LINE DEDENT