Python - Backtracking Solution
python\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        self.neg, self.pos = float(\'-in
```python\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        self.neg, self.pos = float(\'-inf\'), float(\'inf\')\n        \n        self.helper(baseCosts, toppingCosts, target)\n        \n        if -self.neg < self.pos:\n            return target + -self.neg\n        \n        return target - self.pos\n        \n            \n    def helper(self, a: List[int], b: List[int], t: int) -> None:\n        if t < 0:\n            self.neg = max(self.neg, t)\n            return \n        \n        if a == [] and b == [] or t == 0:\n            self.pos = min(self.pos, t)\n            return\n        \n        for v in a:\n            self.helper([], b, t - v)\n        \n        if a == []:\n            self.helper(a, b[1:], t - b[0])\n            self.helper(a, b[1:], t - 2*b[0])\n            self.helper(a, b[1:], t)\n```
[]