Ad
  • Default User Avatar

    This thread was enough to clarify the description. The description has a bug in it in the example where it has '21' it should have '12'.

  • Default User Avatar

    I'm also confused by the description. Even the example is helping me. I'd love to take a crack at this one but I don't even know what's being asked.

  • Default User Avatar

    carry on repeating the operation in the description until all the numbers are equal.

  • Custom User Avatar
  • Default User Avatar

    You have an array :

    [a, b, c, ...]
    

    If one element is strictly greater than another, let's say a < b, then you subtract the smaller from the greater :

    [a, b-a, c, ...]
    

    And you repeat this again and again until it's not possible anymore. At this stage, you sum all the numbers left in the array and return that.

    The thing is (look at the Additional notes section), this method is really ineficient. The real task is to find a way to do the same calculation but much faster.

  • Default User Avatar

    I'll agree with this, I believe the author needs to give a much better explanation

  • Default User Avatar

    Could someone give a more clear description of this kata please? I might just be dumb but the one the author gave is really confusing me and I'm having a hard time getting started on the kata.

  • Custom User Avatar

    It's a problem with your code (yes, it is too slow), not a kata issue.

  • Default User Avatar

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

  • Custom User Avatar

    You're not supossed to multiply that last digit with anything. You should count how many times you need to multiply the number's digits to obtain a single digit number

    39 --> 3 (because 3*9 = 27, 2*7 = 14, 1*4 = 4 and 4 has only one digit)
                       1         2         3  
    

    The single digit value is not related to the expected value.

  • Default User Avatar

    So in the case of 39, the result is supposed to equal 3. I'm confused as to what I'm supposed to multiply the single digit number by (4 in this case) that'll equal that digit.

  • Custom User Avatar

    returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit.

    You're returning the single digit number instead. Please mark your post as having spoiler content next time.

  • Default User Avatar

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

  • Default User Avatar

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