Function to find if the current cell lies in the matrix or not
def isInside ( i , j , N , M ) : NEW_LINE INDENT if ( i >= 0 and i < N and j >= 0 and j < M ) : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT