Golang simple brute force solution
go\nfunc closestCost(baseCosts []int, toppingCosts []int, target int) int {\n\tcost := math.MaxInt32\n\thash := make(map[int]struct{})\n\t// without topping is 
```go\nfunc closestCost(baseCosts []int, toppingCosts []int, target int) int {\n\tcost := math.MaxInt32\n\thash := make(map[int]struct{})\n\t// without topping is accepted\n\tfor _, base := range baseCosts {\n\t\thash[base] = struct{}{}\n\t}\n\tconstruct(toppingCosts, hash)\n\tif _, exist := hash[target]; exist {\n\t\treturn target\n\t}\n\tfor c := range hash {\n\t\tif abs(c-target) < abs(cost-target) {\n\t\t\tcost = c\n\t\t} else if abs(c-target) == abs(cost-target) && c < cost {\n\t\t\tcost = c\n\t\t}\n\t}\n\treturn cost\n}\n\nfunc construct(costs []int, hash map[int]struct{}) {\n\tif len(costs) == 0 {\n\t\treturn\n\t}\n\t// we can\'t modify map when range it\n\tkeys := make([]int, 0, len(hash))\n\tfor k := range hash {\n\t\tkeys = append(keys, k)\n\t}\n\tfor _, k := range keys {\n\t\thash[k+costs[0]*1] = struct{}{}\n\t\thash[k+costs[0]*2] = struct{}{}\n\t}\n\tconstruct(costs[1:], hash)\n}\n\nfunc abs(v int) int {\n\tif v > 0 {\n\t\treturn v\n\t}\n\treturn v * -1\n}\n```
['Go']