Ad
  • Custom User Avatar

    I don't pass 3 args to gcd, it's an initial value in reduce function. There is a formula that relates an lcm through the gcd, so you don't need to use factorisation. But using reduce for making a string from an array was a bad decision - to many string concatenations. Map and join are much more efficient, especially with template strings.

  • Custom User Avatar

    What's up with you passing three args to gcd on line 3. Does this work? Do you mind explaining what's going on in the last two lines? I got the gcd thing. That's very nice!~)

  • Custom User Avatar

    I am having a similar issue. My algorithm is very simple, yet I pass 748 test cases in 0ms according to the testing feedback, all green, no red. But it also times out. How many test cases are there?

  • Custom User Avatar

    Thanks for your comment!

  • Custom User Avatar

    This one was rather interesting. At first, I didn't completely understand the instructions and tried to do something far more complicated than what was asked. After I re-read a few times, it finally clicked. I really need to learn regular expressions and stop relying on loops so much; it seems the more elegant and short solutions accomplish this task in much tidier way. Overall, great kata. I enjoy your work.

  • Custom User Avatar

    I passed the second provided test, but the first one gives a strange error message.

    Can anyone help me understand what's wrong with my output? It looks identical to the expected result to me:

    ✘ Expected: "0 0 Lucky", instead got: "0 0 Lucky"

  • Custom User Avatar

    OK, I putsed the output right before the final return statement. This did not affect the test results, but did let me view the returned string.

    Nothing rings a bell, although the first blank space on the second line is not appearing in the puts output. I don't think this has anything to do with the failures, however, because most of the tests do pass, and they all bear this fault.

    Here is the output including the puts result for the first test that fails:

    ✔ Test Passed: Value == "1 1\n 2 2 \n 3 3 \n 4 4 \n 5 5 \n 6 6 \n 7 7 \n 8 8 \n 9 9 \n 0 \n 9 9 \n 8 8 \n 7 7 \n 6 6 \n 5 5 \n 4 4 \n 3 3 \n 2 2 \n1 1"
    1 1
    2 2
    3 3
    4 4
    5
    4 4
    3 3
    2 2
    1 1
    ✔ Test Passed: Value == "1 1\n 2 2 \n 3 3 \n 4 4 \n 5 \n 4 4 \n 3 3 \n 2 2 \n1 1"

    pattern' block (2 levels) in
    '

  • Custom User Avatar

    Fixed :D Thanks for the catch!

  • Custom User Avatar

    puts the input and try to figure out what could be wrong with that, for starters. If it does not ring a bell, tell me more about it.

  • Custom User Avatar

    My Ruby solution to this Kata passes all of the 'random' tests, but fails the 'basic tests'.

    In fact, the tests themselves all pass, but they have a red flag next to them, and an error message appears below.

    The error message says:

    pattern' block (2 levels) in
    '
    I don't understand what this means, or why it's failing. The output seems to be correct!!!