

def minCostII(self, costs):
    '\n        Lef F[i][j] be the total min costs when the houses BEFORE i are painted, with (i-1)-th house pained as color j\n        F[i][j] = \\min(F[i-1][k] + cost[i-1][j] \x0corall k, k != j\n\n        edge case handling for i\n        :type costs: List[List[int]]\n        :rtype: int\n        '
    if (not costs):
        return 0
    n = len(costs)
    m = len(costs[0])
    F = [[0 for _ in xrange(k1)] for _ in xrange((n + 1))]
    for i in xrange(1, (n + 1)):
        for k1 in xrange(m):
            F[i][k1] = min(((F[(i - 1)][k0] + costs[(i - 1)][k1]) for k0 in xrange(m) if ((i == 1) or (k1 != k0))))
    return min((F[n][i] for i in xrange(m)))

dataset/ETHPy150Open algorhythms/LeetCode/265 Paint House II.py Solution.minCostII/VarMisuse@53/207 `m`->`k1`