A Java Easy Recursive Soln
```\nint d=Integer.MAX_VALUE;\n    int ans=Integer.MAX_VALUE;\n    public void  rec(int[] baseCosts, int[] toppingCosts, int target,int cs,int ci){\n        \n 
```\nint d=Integer.MAX_VALUE;\n    int ans=Integer.MAX_VALUE;\n    public void  rec(int[] baseCosts, int[] toppingCosts, int target,int cs,int ci){\n        \n        if(Math.abs(cs-target)<d){\n            d=Math.abs(cs-target);\n            ans=cs;//Math.min(cs,ans);\n        }else\n        if(Math.abs(cs-target)<=d){\n            d=Math.abs(cs-target);\n            ans=Math.min(cs,ans);\n        }\n        \n        if(ci>=toppingCosts.length){\n            return ;\n        }\n        \n        for(int m=0;m<=2;m++){\n            rec(baseCosts,toppingCosts,target,cs+(m*toppingCosts[ci]),ci+1);\n        }\n    }\n        \n    public int closestCost(int[] baseCosts, int[] toppingCosts, int target) {\n        \n        for(int i=0;i<baseCosts.length;i++){\n            rec(baseCosts,toppingCosts,target,baseCosts[i],0);\n        }\n        \n        return ans;\n    }
[]