7 kyu
Find your caterer
697 of 1,407riyakayal
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
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!
Please read the description carefully:
Not a kata issue.
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.
Thanks for noting that out, revised an author's solution so it now works properly at cases when
people = 1
:)CoffeeScript translation
Approved by someone
JS fork hotfixing the issues below
Approved by someone, thx :)
@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.
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.
Yes, I think it's an error in the JS translation. Unfortunately it seems like it was carelessly approved without addressing any of the feedback given to it.
I think that what you're seeing is the result of the
actual
andexpected
values being swapped in the assertion messages. The correct message would be "Expectedundefined
to equal1
", meaning your function returnedundefined
when it should have returned1
.Should be fixed now
@NunoOliveira - you're correct - looks like the issue was with my solution. I'm still seeing the "undefined and 1" being swapped so that should still probably be fixed but I did need to change my code too.
You can just reset the Kata Trainer with the button of the same name to get the new version of kata
(also your solution now passes all tests :D )Doh, you're right. Sorry - didn't realize the version wouldn't update automatically.
JS Translation
it seems to me that there are errors in the test cases. example:
maybe I'm misunderstanding the condition?
You need to choose only one company,
otherwise there will be competition, disputes, scandals, fights, knife fights to the point of blood.
And nobody needs it. So choose one company and try to spend all the money to the maximum.
Just don't steal!
that's what I'm talking about.
we have a test case where there is $200 and 5 people. in this case, it is enough for us to make an order in the premium buffet with $30 per person and we will spend $150, which is the maximum possible (provided that the number of orders is equal to the number of people). but the code fails the test because 3 is the expected result and not 1.
am i wrong?
You're not attentive.
basic buffet != premium buffet
Therefore, if possible, we should try to feed people in a more prestigious institution
And this, as you correctly noted, is for 5 people * $30 per person == $150. And the answer is number 3
Ah, I understood! we need to hire ONLY ONE catering company, not a combination of several. and indicate the number of this company in the answer. I thought we needed to specify the number of catering companies, the combination of which would provide the result as close to the budget as possible.
beatufil cata
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.
C Translation
approved :)
In Java:
The code which will fix this error:
Fixed now.
Random tests never expects
-1
.For python, I have now included tests where output will be -1. -1 was covered in basic tests though.
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)
)Both are done. I made these changes since the original java translator was not available for correcting them.
Java Translation
Java has been approved by someone
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:
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.
"You could also specify that you must purchase exactly one meal per person;" -- Done.
I may create other katas on the lines of maximising profit for the organiser, as you suggested. I have thought along that line when I wrote this kata, but will need to find some free time to create variants.
Thanks for the suggestion.
Hi,
per person
and the third one has a premium buffet at $30per person
.>60
?>=60
?cheers
Done.
You might mention you want ALL people to get served. In my initial attempt I sent some people home so that others could eat.
That's against social decorum :) I will include the clause if at least 10% warriors want it after the kata has been solved 100 times.