Ad
  • Custom User Avatar

    It would be 6 Kyu if the user is enforced to implement an efficient algorithm.

  • Custom User Avatar

    Should be reclassified as 6 kyu (it is definitely not 7 kyu level kata)

  • Custom User Avatar

    Duplicate of this + this.

  • Custom User Avatar

    It's a hell of a kata for level seven | label it as level 6 seems to me more appropriate.
    I had a great time solving this kata — appreciate your contribution.

  • Custom User Avatar

    This is not a level 7 Kata lol

  • Custom User Avatar

    Yup that does make sense. I mentioned to start from index 0 to indicate starting from left to right but have added your line as it makes it much clearer, thanks!

  • Custom User Avatar

    Heya! Fun kata, but I ran into a few problems.
    Your reference solution has a left -> right bias in terms of parsing the string.
    Eg. peelPairs('12251', 6):

    • Working l->r: the answer is 221. Total distance between the pair characters (1, 5) is 3. This is the result the reference produces.
    • However, r->l: the answer is 122. Total distance between the pair characters (1, 5) is 1, they're adjacent. This is closer than the acceped solution, but will not be accepted.

    Given that the instructions state they should be paired with the closest digit to them that sums to n, I think you should clarify the instructions to include closest digit **to the right** of them that sums to n.

    Hopefully that makes sense :D

  • Custom User Avatar

    .

  • Custom User Avatar

    Nice one.
    But sample tests missed ;-)

    EDIT:
    And, in the initial code, (str) should be (str,n)

  • Custom User Avatar

    Thanks!
    I didn't mean to make it repetitive as I thought I was testing different things (but maybe not).

  • Custom User Avatar

    I originally found the problem on Project Euler and did a quick search for it here but couldn't find it (clearly my search wasn't very thorough!).
    The last bit was just meant to add an extra element to the problem-solving that I thought utilised different skills.

  • Custom User Avatar

    It gets a bit repetitive at the end. But otherwise great job.

  • Custom User Avatar

    That sounds like yet another attempt to prevent people saying it's an exact duplicate to a kata by being the exact duplicate of two katas combined.

    Which means double unsatisfied. I wish I can vote twice.

  • Custom User Avatar

    May be 'cause there's yet a Difference of Squares kata ?

  • Custom User Avatar

    Okay, I understand the part about finding E(X^2) - E(X)^2.

    But why finding the square sum of digits of the result?

    The last part doesn't really make any sense.