• + 0 comments

    def coveringStains(k, coordinates): def get_bound(coords): mi_x,mi_y = float("inf"), float("inf") ma_x,ma_y = float("-inf"), float("-inf")

        for x,y in coords:
            mi_x = min(mi_x, x)
            ma_x = max(ma_x, x)
            mi_y = min(mi_y, y)
            ma_y = max(ma_y, y)
    
        return mi_x, mi_y, ma_x, ma_y
    
    bound = get_bound(coordinates)
    n = len(coordinates)
    count=0
    
    for combo in combinations(coordinates, n-k):
        combo_bound = get_bound(combo)
        if combo_bound != bound:
            count+=1
    
    return count