Update the minimum column - wise
for j in range ( M ) : NEW_LINE INDENT for i in range ( N - K + 1 ) : NEW_LINE INDENT mn = sys . maxsize NEW_LINE for k in range ( i , i + K ) : NEW_LINE INDENT mn = min ( mn , nums [ k ] [ j ] ) NEW_LINE DEDENT nums [ i ] [ j ] = mn NEW_LINE DEDENT DEDENT