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 just published the R translation of this Kata.
Please, check it out and comment or approve it.
It is my first Kata translation, so I am open to any constructive criticism.
This comment is hidden because it contains spoiler information about the solution
In R, only a few libraries can be loaded in the soluntions, and non of them contains a function to test prime numbers or factorize numbers. So, I wrote my own code. It works but it runs out of time.
Any suggestions or tips to beat the clock?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I don't do R, sorry. But are you sure your code is O(n)? Try posting it following this, and I (or someone else) will take a look at it.
Let me rephrase. I know it's solvable. Do you have any suggestions to optimize O(n) code in R? I am unsure which operations are more time consuming or if I should use a particular package
I run out of time with this kata in R. I am pretty sure my code is O(n), but I got stuck at approx. 54 test cases. Suggestions accepted!
Got it! Thanks mate
^ That dictionary. You're passing
''
as a key to it.Can you please elaborate further? I do not define any dictionary in my solution, which contains only a list within the function scope and returns a string. I think the definition of the problem does not request any dictionary
No, that's a problem with your code, not a kata issue. You're passing a key to the dictionary that doesn't exist.
I think there is an issue with tests in Python. My code passes all tests, but I get a STDERR message:
Time: 508ms Passed: 10 Failed: 0 Exit Code: 1
Test Results:
Example from description [...]
Basic Morse decoding [...]
Extra zeros handling [...]
STDERR
Traceback (most recent call last):
File "/workspace/default/tests.py", line 30, in
testAndPrint(decodeMorse(' . . '), 'E E')
File "/workspace/default/solution.py", line 11, in decode_morse
msg += MORSE_CODE[char]
KeyError: ''