Ad
  • Custom User Avatar

    Your reasoning is more or less okay, the problem is with the test you think to be failing. When I try to run your solution, I see that it fails following test case:

    recipe:  { cream: 200, flour: 300, sugar: 150, milk: 100, oil: 100 }
    available:  { sugar: 1700, flour: 20000, milk: 20000, oil: 30000, cream: 5000 }
    

    Your solution has a bug which fails for the input above, but it works for the input which you showed and I am not sure what exactly leads you to the conclusion that your solution fails your test, and not the one I found.

  • Custom User Avatar

    You should use console.log to print inputs, and probably some other variables too. This way you'll know exactly which test case failed.

  • Custom User Avatar

    Your solution fails other test than you showed above.
    Your solution has a bug, it is not a kata issue.