You need to sign in or sign up before continuing.×
5 kyu
Help Suzuki pack his coal basket!
131 of 196user8476848
Loading description...
Dynamic Programming
Algorithms
Data Structures
Mathematics
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.
python new test frameworks
How can I remove an incorrect solution made due to imperfections in random tests?
It can't be removed, but you also do not need to remove it. Just leave it as it is, it does not hurt anything.
Thanks.
Very nice finding out the dynamic, optimal solution to this one.
CoffeeScript translation
COBOL translation (author gone).
omfg, I have done this) @user8476848, thanks for this kata! Cheers!
This is probably way too hard for a 5kyu.
I'd suggest up-ranking it to 4kyu or so.
How to up-rank it (who can do it)? Or are you changed your mind? ;)
nobody can except admins, at the current time.
Not sure. In the same vein, we have Packing your backpack, substantially harder, and 5 kyu too.
This comment has been hidden.
I'm not understanding something or one of the examples is incorrect.
You cannot make 47 from any combination of 83, 45, 25, 22, and 46. What gives?
25 + 22 = 47.
Oh wow. That's embarassing. Thanks!
My poor greedy thief, why no guys to solve that one?
https://www.codewars.com/kata/58296c407da141e2c7000271
And this one is needing your solution myjinxin......it is calling you :)... https://www.codewars.com/kata/57dc0ffed8f92982af0000f6
I try this one two days ago, but I can not understand some rules, so I can not solve it ;-)
I am sorry which part?
@rollietikes
,I just started on this kata and I am getting these odd error messages.
My output seems to be matching what the
test.it
describes but that doesn't seem to be the correct answer. All of the other random tests where my output matches thetest.it
message, I getTest Passed
.As I said, I just started on this kata and it's entirely possible that my code is wrong. If that is the case, something seems to be wrong with the error messages. Otherwise, it seems like something could be wrong with the random tests.
I'm leaning towards my code being wrong since other people have passed this kata already but maybe you could take a look at the random tests just to make sure they are correct.
Thanks!
EDIT:
Just to show you what I mean about the passing random tests:
In those passing random tests, my output also matches the
test.it
message above saying what the return value should be.Thanks let me try these tests.
Hi Zebulan please forgive me if I do not fully understand the issue. I do not think the test is incorrect on this one.
This would be a correct return as Suzuki has packed the basket to 66 Kilograms but he could have packed it to 67 Kilograms therefore returning 66 is an incorrect answer.
"returns The basket weighs 66 kilograms ✘ It should work with random inputs too: 'The basket weighs 66 kilograms' should equal 'The basket weighs 67 kilograms' " The function should return 66 KG. In the cases where you are returning 192 and the basket weighs 192 it is because there were enough rocks in the pile to totally fill the basket to 192KG so the return equals the capacity of the basket but this is not always the case as there are not always enough rocks to equal the exact basket weight.
Does this make sense?
@rollietikes
,Sorry for the confusion, I was just doing some more tests on my computer and I am almost 100% sure that my code is wrong. I guess it's just that the message is confusing. I was reading the
returns ...
message as what the answer should be and then theshould equal
message didn't match it.I'm not sure how the tests are set up but the
returns ...
message almost seems unnecessary since theshould equal
error message shows what the correct output should be. If you are going to leave it there, maybe something likeYour function returns ...
would be more explicit.Ok no worries I am working on translating this one to a few more languages now so I will try to improve the messages. Thanks for helping with this Kata trying to get it out of beta!
@rollietikes
,I am enjoying this kata so far, my first approach didn't work but I will keep working on it. I will be sure to upvote as soon as I finish it!
Thanks again and sorry for the confusion!
Nice one. 'Made me a little bit crasy, at some time... ;) (I am not confortable with greedy algorithms yet)
Once again, I have some suggestions :
If you apply those suggestions, you won't need anymore to display the pile used for the random tests (this display is not really easy to use right now, because you give the pile, but not the value of basket. Maybe add that if you want to keep the display of pile ?) and your output would be lightened so you could... :
What do you think ?
This comment has been hidden.
I have added a new basic test. basket = 10 pile = 'dust83dust 45 25 22 46' Test.assert_equals(pack_basket(basket,pile), 'The basket weighs 0 kilograms')
thanks, I will check about de DPA :)
(it seems you do not want to add the last test case... Ok ! ;) )
Yes the second suggestion I need to think about. Strings like "dust6dust34" should not be showing up in the random tests. This is not part of the tests which is why it's not in the basic tests.In all cases there should be only one integer with dust in the string.
Oh, "might" be I'm wrong about that, in fact... I double checked the random cases and effectively it does not generate this pattern. I think I overthought the thing(k... ;p ) after I read gtnumen suggestion below. Sorry !
(but it could be a nice idea to implement that ! ;) )
No worries.... I have a couple other Kata brewing right now that will be probably be 2 or 3 kyu. The harder ones take forver to get out of Beta. I hope to see you solve them and help me with QA! Be sure to give them a rank. Thanks
Where can i find those betas, please ? :) (I didn't find them on your profile page)
(rank already given ! ;) By the way, I find your opinions (you and somepeople below in this kata or an other) quite hard about that. Your betas seem to me harder than just 7 or 6 kyu !)
I have not published any new ones. Keep an eye out in the next week or so I plan to publish. My personal rank for this one is a 5kyu it's been ranked 4-6kyu by the community so pretty close. I agree some of my Kata are ranked 7kyu and they should really be 6Kyu but this is decided by another moderator and they go off of average power use ranking,community ranking, and personal opinion.
Ok, I'll keep an eye on this. :)
Good kata overall!
Some super minor feedback:
You could up the difficulty slightly by allowing strings like
'dust20dust5'
.I also think that the testing limits could be better defined by stating that the maximum amount of coal pieces in the pile is 100, not just
1 <= pile <= 100
, which I assume means up to 100 coal pieces.Other than that, it was fun. Thanks!
ok great feedback and im glad you enjoyed it!
Only the second (but python is not my "main language"):-), good kata, well done;-)!
Thanks Smile and nice solution!
Thank you very much for awesome kata! :) Have a nice day!
Thanks for the feedback gabbek and congrats on being the first Code Warrior to solve it. You have a nice day as well! :)