C++ || DFS Solution || Simple & Concise code
Please do upvote if you like my code :)\n\n\nclass Solution {\npublic:\n    \n    int ans = 100000;\n    \n    void helper(vector<int>& toppingCosts, int target
**Please do upvote if you like my code :)**\n\n```\nclass Solution {\npublic:\n    \n    int ans = 100000;\n    \n    void helper(vector<int>& toppingCosts, int target, int currSum, int index)\n    {\n        if(abs(target-ans) > abs(target-currSum)) ans = currSum;\n        else if(abs(target-ans) == abs(currSum-target)) ans = min(ans, currSum);\n        \n        if(index == toppingCosts.size()) return;\n        \n        helper(toppingCosts, target, currSum, index+1);\n        helper(toppingCosts, target, currSum+toppingCosts[index], index+1);\n        helper(toppingCosts, target, currSum+2*toppingCosts[index], index+1);\n    }\n    \n    int closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int target) \n    {\n        for(int i=0; i<baseCosts.size(); i++)\n            helper(toppingCosts, target, baseCosts[i], 0);\n        \n        return ans;\n    }\n};\n```
['Backtracking', 'Depth-First Search', 'C', 'C++']