6 kyu
How many elephants can the spider web hold?
231 of 495izubi
Loading description...
Fundamentals
Algorithms
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.
64 should equal 15 What are the input values used for the last case ?
Python
Input:
strength=532000, width=5, expected=15
Actually, this isn't the last input value of the tests, but rather your program is too slow or ran into an infinite loop for this input.
You can learn more at the below links:
I get Execution Timeout. Why?
How can I see which input causes my solution to fail?
Good luck & all the best in tackling this kata!
Java: Missing random tests
Fork
C Translation
Thank you so much!
Resolved - Approved by author.
JS
Mocha + chai should be enabled
No random tests
JS fork
please provide a reference for Mocha?
thanks
Issue resolved - JS Fork approved by author
Codewars - Mocha doc
Please review: C++ Translation
Done! Thank you so much for your effort & support!
Interesting kata, thanks for it! :)
Thank you so much!
Thanks!
Please make python tests not useless - obligatory solution.
Hello!
I updated the description, I hope it is clearer now.
Thanks!
There seems to be an issue either in the description or in the 3rd test. The description says that strength represents the weight that breaks the web and the task asks us to calculate how many elephants can be placed without breaking the web, so total weight of elephants should be smaller than the strength of the web.
However, test case 3 expects a web with strength 532000 and width 532 to be able to hold 532 elephants. This means that 532 elephants on the first row, weighing 1000kg each, for a total of 532000kg would not break the web with strength 532000. Since 532000kg is explicitly stated as the weight that breaks the web, the expected answer seems to be wrong.
It would be better to either make it clear in the description that the web will still hold the weight exactly equal to its strength or change the expected output of the third test to 531 elephants.
Hello!
Thank you so much, you are right. Strength represents the weight the web can hold, so the description is wrong. I have updated it, thank you so much for your detailed explanation
This comment has been hidden.
I returned 'strenght' and 'width' for tests and noticed that in a few non-random tests 'width' is equal to 1, but expected answer is more than 1. Any idea what's going on?
My code is correct for every random test. I implemented the code in Python.
The function name should be in snake_case in Python.
.
Java: the initial solution is missing the constructor... Which doesn't even make sense...
=> Java version should be updated to a static method only, to be complient with the other languages (there is no need/interest to have an instance for this problem)
edit: ...or if we really care about 30 solutions only... just add the complete code for the constructor...
what the... x(
author inactive, and author is BBVA... Meaning, it's "yet another copycat"... x( (95% of them are...)
constructor added. Closing.
With some guessing and luck I could solve this kata easily in Python and JS. In java however, it seems we have to manage an instance of class SpiderWeb and not a single function with parameters like elsewhere. I think description should provide the correct informations relative to this class for users to be able to handle it, or not?
opened as issue.
handled
Thanks ;)
Adding some random tests would be good.
Re-raised as an issue here - only Java missing random tests for now
Ok, done. And now I'm sure: the description is absolutely awful... xs
I strongly recommand that you break down one complete example because there are several points where the explainations are so vague, that it's possible to completely miss the behavior you expect.
Moreover, some parts are wrong:...
Na, all is completely wrong. Nothing makes actually sense when talking about a 2D web, then a pyramid of elephant that goes "up". I tried to detail each problem, but really, that doesn't make ANY sense. So here is what the description should be, imo:
some points:
kg
, notKg
When rows are full (the width of the web is reached)
that is completely wrong, whatever is the representation of the problem you're using. Just put the next point in the description before this one, and just stick toWhen rows are full
next elephant goes up one level, and weight 1000Kg more than the previous one
and that is wrong too. Should be:next elephants go up one level, and weight 1000kg more than those of the achieved row
or somethign equivalent.Hello Blind4Basics,
thanks for the suggestions! I updated the things you proposed.
Kg vs kg ... That's a nice one. I confused the notation with Gb, Mb, ... Corrected :D
Thanks!
of the structure fitS one elephant less
;)Ok, done!
I need to work on my english hahaha :D
Thanks!
I modified sligthly the presentation of the tests, while approving (
print('<COMPLETEDIN::>'
). You should take a look at the new test framework, if you want to author new katas. ;)Hello!
Thanks for the recommendations, I added random tests, worked the description and added a note about invalid numbers.
Thanks!
Hi,
Something seems unclear in the description: is the web 2D or 3D ? Meaning:
width*width
and the elephant are stacked ?I didn't try yet, so I didn't see the example tests, but considering you talk about "elephant on the first row, second row..." instead of "first, second place", the doubt remains, while reading the description only. A small update about that would be nice... ;)
Hello Blind4Basics,
the web is 2D. The elephants are stacked upwards, something like this:
sixth row : * fifth row : ** forth row : *** third row : **** second row: ***** first row : ******
Thanks for the feedback
I barely understood the problem thanks
This comment has been hidden.
This comment has been hidden.
Hi charless,
the solution must be the number of elephants the web can hold, not the number of elephants that break it. I have reviewed the description, I hope it is clearer now.
Thanks for the feedback!
But why are the heavy elephants on top of the lighter ones? This seems a cruel way to stack elephants!
Hahahaha thas a good question :D I just want to turn those skinny elephants on super hero elephants