[Python3] Short Ternary Bitmask Solution
\nimport numpy as np\n\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        res, dist = 10 *
```\nimport numpy as np\n\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        res, dist = 10 ** 4, 10 ** 4\n        n = len(toppingCosts)\n        m = 3 ** n\n        for b in baseCosts:\n            for i in range(m):\n                cost = b\n                rep = np.base_repr(i, base=3)\n                rep = "0" * (n - len(rep)) + rep\n                for j in range(n):\n                    cost += toppingCosts[j] * int(rep[j])\n                if abs(cost - target) < dist or cost <= target and target - cost == dist:\n                    dist, res = abs(cost - target), cost\n        return res\n```
[]