Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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!~)
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?
Thanks for your comment!
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.
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"
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'
Fixed :D Thanks for the catch!
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.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!!!