C++ using recursion with comments
```\nclass Solution {\npublic:  int mn = INT_MAX; int ans = INT_MAX; \n       void rec(int n ,vector& toppingCosts,int sum, int target, int i  ){ \n           /
```\nclass Solution {\npublic:  int mn = INT_MAX; int ans = INT_MAX; \n       void rec(int n ,vector<int>& toppingCosts,int sum, int target, int i  ){ \n           // if  current difference is minimum differnce till now take ans = current sum \n           if(abs(sum-target) < mn){ \n             mn = abs(sum-target); \n             ans = sum; \n           }\n\t\t   // if  current difference is  equal to minimum differnce till now decide which is minimum current ans or current sum\n           if(abs(sum-target) == mn){ \n            \n             ans = min(ans,sum); \n           }\n\t\t   // if we came out from the indexes\n            if(i==n)return;\n\t\t\t// use recursion when taking 1 topping , 2 topping and no topping....\n           rec(n,toppingCosts,sum+toppingCosts[i] , target , i+1);\n           rec(n,toppingCosts,sum+2*toppingCosts[i] , target , i+1);\n           rec(n,toppingCosts,sum , target , i+1);\n          \n        \n        }\n    \n    int closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int target) {\n          int n = toppingCosts.size(); \n          int m = baseCosts.size(); \n          for(int i = 0; i<m ; i++){ \n             int sum =baseCosts[i];\n\t\t\t // here we chossing base one by one which fit to our ans\n          rec(n,toppingCosts, sum,target,0); \n            \n          }\n        return ans;\n    }\n};
[]