Ad
  • Default User Avatar

    I agree. I think most people (including myself) approached the problem as if a number in the array had to be divisible by its index, but this doesn't work correctly for index zero as we cannot divide by zero. However, as you suggested, zero is a multiple of every number, including itself. I agree that if zero appears at the zeroth index it is a valid multiple and should probably be included.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Try printing the input. Then you can see what inputs cause your code to fail and debug it from there.

  • Default User Avatar

    It means you have given a word that the kata writer does not consider to be in the input. The most likely explanation is that you have split a word where the writer did not want you to (e.g. splitting "wor'd" into "wor" and "d") or you have joined two or more words that the kata writer considered to be separate. Try printing the input immediately and you should get a better idea what the random tests are like. Only apostrophes can be used to connect letters together into one word.

  • Default User Avatar

    There is currently an example of this in python: one of the test cases has 'CodeWars is nice' as the input with the expected result '#CodewarsIsNice'. When this test is failed the message 'Should capitalize all letters of words - all lower case but the first.' is given.

  • Default User Avatar

    Tax is a rate you must pay as a percentage of your earnings. Your invested savings themselves are not included in the tax calculation, only the earnings made from the interest. If, in a given year, you earn $100, a tax rate of 20% (0.2) would mean $20 must be paid as tax. Your invested savings would increase by $80 that year.

  • Default User Avatar

    For anybody still wondering what behaviour the kata requires for apostrophes or hyphenation: hyphenated words should be broken up into two separate words (e.g. "three-quarters" becomes "three quarters").

    Apostrophes are treated as letters iff they are beside actual letters, or other apostrophes that are. Apostrophes alone do not form a word.

    ''h'el''lo is a considered word, while ''' is not

  • Default User Avatar

    I noticed a small potential issue in the python random tests. Inputs are given with a space " " as the final character in the string, which I would not have expected based on the description, examples or fixed tests.

  • Default User Avatar

    I think there is still a bug that means it fails a small number of cases. I suspect there are very specific circumstances where a bug in the code breaks the method. While trying to understand what these circumstances were, a test ran without any examples of the cases that break the method and I accidentally submitted. This is also why my debugging print statements are also present.

  • Default User Avatar

    I think it is clearer now. Thanks.

  • Default User Avatar

    "Maybe mentioning the brick is the largest you can fit inside the bottle would help, yes, it's like that in the picture, but in words would be better."

    This is my only point. The wording of the geometry problem at the heart of the kata could be improved by clarifying that the ice brick placed into the bottle is the largest possible cuboid that could actually fit inside the inner volume. This would eliminate the ambiguity. My example in the previous comment was only to give an example of the ambiguity, by demonstrating how multiple bricks satisfy the requirements of the magic trick and thus why additional wording is needed to define a specific one: the largest possible.

  • Default User Avatar

    The ambiguity is that the entire range of values between rim_radius and bottle_radius is potentially valid for the magic trick to be significant. So if the inner radius of the rim were 3cm and the inner radius of the bottle 5cm then the brick going inside the bottle would still be significant for any brick whose effective radius exceeds 3cm but not 5cm. So 5cm, 4cm (and any of the infinite possible none integer values satisfying 3cm > x >= 5cm) would be valid. You have to assume from the parameters given that you are supposed to go only for the maximum sizes.

  • Default User Avatar

    In my opinion there is still some ambiguity in the problem that is probably confusing some people. Based on the dimensions of the bottle that are specified, we must assume that the problem intends for us to calculate the largest possible cuboid ice brick that can fit inside the cylindrical volume at the bottom of the bottle. I suspect some may get confused by initially considering that smaller ice bricks (reduced in any dimension) could also fit in that space and would still be impressive from a magic trick perspective if the dimensions exceeded the rim radius. Perhaps the kata could specify that the ice brick is the largest possible one that could fit in that space, or that it fits inside the volume such that all of its vertices are in contact with the internal surface of the bottle.