6 kyu

How many elephants can the spider web hold?

231 of 495izubi
Description
Loading description...
Fundamentals
Algorithms
  • Please sign in or sign up to leave a comment.
  • susonar Avatar

    64 should equal 15 What are the input values used for the last case ?

  • Just4FunCoder Avatar

    Java: Missing random tests

  • rowcased Avatar
  • ejini战神 Avatar

    JS

    • Mocha + chai should be enabled

    • No random tests

  • 66  Avatar

    Please review: C++ Translation

  • Ciprian Amza Avatar

    Interesting kata, thanks for it! :)

  • MobulaKuhlii Avatar

    Please make python tests not useless - obligatory solution.

  • SergeyOvchinnik Avatar

    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.

  • eldeetee Avatar

    This comment has been hidden.

  • antoniskoczylas Avatar

    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.

  • FArekkusu Avatar

    The function name should be in snake_case in Python.

  • Blind4Basics Avatar

    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...

  • akar-0 Avatar

    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?

  • jamesyoung79 Avatar

    Adding some random tests would be good.

  • Blind4Basics Avatar

    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:

    • the web isn't a web and moreover isn't 2D, it's a cord and it has only one relevant dimension: its length (no "width", so)
    • elephants make a pyramid, each row above the other
    • with this representation, the fact that the "percieved weight" of an elephant increase by 1000 at each row "can make some sense" (all the same, it's purely a mathematical requirement, so just saying)

    some points:

    • kg, not Kg
    • 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 to When 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.
    • a "strength" in "kg"...? Errrr... Let's say that's not as important as the above points.
  • Voile Avatar
    • Needs random tests
    • Description needs more work
    • Need to mention you're inputting invalid numbers in the tests, e.g with arguments of negative number
  • Blind4Basics Avatar

    Hi,

    Something seems unclear in the description: is the web 2D or 3D ? Meaning:

    • 2D = one line of length "width", and elephant stacked above each others ?
    • or 3D = the web is a square 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... ;)

  • chartless Avatar

    This comment has been hidden.

  • dinglemouse Avatar

    But why are the heavy elephants on top of the lighter ones? This seems a cruel way to stack elephants!