Flip all the bits in this square sized submatrix
for p in range ( 0 , K ) : NEW_LINE INDENT for q in range ( 0 , K ) : NEW_LINE INDENT if ( a [ i + p ] [ j + q ] == '0' ) : NEW_LINE INDENT a [ i + p ] [ j + q ] = '1' NEW_LINE DEDENT else : NEW_LINE INDENT a [ i + p ] [ j + q ] = '0' NEW_LINE DEDENT DEDENT DEDENT