7 kyu

Find your caterer

697 of 1,407riyakayal
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Slaizi Avatar

    I think there is an error in test 3, because if 61 * 30 = 1830 is more than our budget (1500) then 3 cannot be returned!

  • retrowaveRecluse Avatar

    First attempt at passing in JS just now failed on small random test, one single point of failure and rest of test cases passed. Passed on second attempt through random tests.

    Expected 3 to equal -1.

  • LosBlobbos Avatar
  • 4500zenja1 Avatar

    JS fork hotfixing the issues below

  • Kacarott Avatar

    @riyakayal If you don't want your ability to approve translations to be revoked, then you need to stop blindly approving translations without reviewing them, especially when someone else has already reviewed them and left notes which you are blatantly ignoring by approving.

  • Tarrega88 Avatar

    It appears there's an error in this kata (JS version)- I'm seeing "Expected 1 to equal undefined" on one of the samples, and all other tests are passing.

  • URock Avatar

    it seems to me that there are errors in the test cases. example:

    1. test: assertEquals(3, Budget.find_caterer(1500,61)); but I can provide all the people with just two catering companies: 33 people * $20 + 28 people * $30 = $1500
    2. test: assertEquals(3, Budget.find_caterer(200,5)); but only one catering company is enough: 5 people * $30 = $150 and that's the maximum.

    maybe I'm misunderstanding the condition?

  • Kees de Vreugd Avatar

    Satisfaction on the low side, but a lot of effort made to deal with suggestions/ issues raised (and it's a fun little Kata). Approved.

  • rowcased Avatar
  • rowcased Avatar

    In Java:

    Failed to detect class name:
    public static int find_caterer(int budget, int people) {
      return 0;
    }
    
  • Voile Avatar

    Random tests never expects -1.

  • Voile Avatar

    The function name in Java translation was completely changed from the original: find_caterer -> Budget.chooseBudget. It should be fixed so the translation actually conforms to the original version.

    (It's also missing the test case test.assert_equals(find_caterer(940, 70), -1))

  • juanma.ef Avatar
  • RileyHunter Avatar

    While not really in scope for this kata, there are edge cases where ordering more meals than required leads to a more optimal expenditure of the budget.

    For example, with 60 people invited and a budget of $1750.00 the naive calculations yield the following:

    Caterer 1 = 15 * 60 = $900.00
    Caterer 2 = 20 * 60 = $1200.00
    Caterer 3 = 30 * 60 = $1800.00
    

    which would return (1750, 60) => 2.

    However, if we instead order 72 meals from Caterer 3 we can feed everyone the premium food and spend more of the budget:

    Caterer 3 = 24 * 72 = $1728.00

    This occurs because the cost for Caterer 3 is not a monotone function. One way to resolve this while retaining similar complexity would be to have Caterer 3 give a discount for each subsequent meal after a certain cutoff, rather than for every meal once the number of people hits a certain value. You could also specify that you must purchase exactly one meal per person; it's reasonable to assume that you can't purchase too little food but I see no specific issue with purchasing too much to get better food and spend the budget more optimally.

    Again, I don't think this counts as an issue, just a suggestion to clarify.

  • Blind4Basics Avatar

    Hi,

    • the description is incorrect: The second one has an economy buffet at $20 per person and the third one has a premium buffet at $30 per person.
    • the kind of boundary isn't given for the third caterer: >60? >=60?
    • no tests for the boundary of the third caterer

    cheers

  • yLaWy Avatar
    • The error messages in the random tests should show the input parameters of the function to make it clear to the user what parameters gave the error, "It should work for random inputs too" is not a sufficient error message;
    • The description is not language agnostic (avoid writing the function name because it changes between translations)
  • dfhwze Avatar

    You might mention you want ALL people to get served. In my initial attempt I sent some people home so that others could eat.