Backtracking - python - easy to understand
\n```\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        bases = {}\n        res = set()\n
\n```\nclass Solution:\n    def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int:\n        bases = {}\n        res = set()\n        for i in range(len(baseCosts)):\n            bases[i] = baseCosts[i]\n        start = 0\n        for base in bases:\n            self.find_options(target,toppingCosts,bases[base],res,start)\n        dis = None\n        min_val = None\n        for val in res:\n            if min_val == None:\n                dis = abs(target-val)\n                min_val = val\n            else:\n                if abs(target-val) < dis:\n                    dis = abs(target-val)\n                    min_val = val\n                elif abs(target-val) == dis:\n                    min_val = min(min_val,val)\n        return min_val\n                    \n    def find_options(self,target,toppingCosts,cur_cost,res,start):\n        res.add(cur_cost)\n        if start < len(toppingCosts):\n            for j in range(3):\n                self.find_options(target,toppingCosts,cur_cost+j*toppingCosts[start],res,start+1)\n
[]