from typing import List


def brute_force_tree_aux(houseNumber: int, costs: List[List[int]], prevColor: int, currentCost: int) -> int:
    """
    Brute force approach to picking the house colours.
    This creates the entire search tree and picks the smallest value. The search space is huge.
    :param houseNumber: the number of house to pick
    :param costs: the costs per house by colour
    :param prevColor: the previous colour used
    :param currentCost: the current cost so far
    :return: the minimum cost in this subtree
    """
    # If we are done, return the cost.
    if houseNumber == len(costs):
        return currentCost

    # Try colouring this house all of the colours and pick the minimal cost.
    return min([brute_force_tree_aux(houseNumber + 1, costs, color, currentCost + cost)
                for (color, cost) in enumerate(costs[houseNumber]) if color != prevColor])