Sorry that no one answered this question before. It's a nice kata.
When you're editing your kata, there are four different tabs in the lower left:
"Complete solution" needs to contain your solution and needs to pass all your tests for the kata to be valid.
"Initial solution" should not be empty, but contain a skeleton that the user can start coding in. Normally, you would just put an empty method here with the correct name.
"Preloaded" can contain code that is accessible to the user when solving the kata. But since the user can't see this code, you need to document it in your description. It's mostly empty.
Note that when you run the tests, they are run against whatever code you have active in this window. So before you save your kata, run your tests against the "Complete solution."
Let me know if you have any more questions and I'll try to answer them as well. :-)
Solving this in Ruby:
Recursion: passed tests, timed out on submit
Memoization: passed tests, timed out on submit
Math: passed tests, passed all submits except very high values (where I am assuming floating point becomes inaccurate)
So basically, a challenging Kata (for me anyway :)) ... I'm tempted to look at the solutions but also want the satisfaction of solving this on my own. Any hints on the right direction? Is there an approach I am missing?
I have few katas back here at my computer but I'm not uploading them on CW right now, I'm waiting to learn a new thing with String.prototype.replace() and use it in them and then I will upload all the related katas at the same time as The katas from #12 to #15 are related to each other.
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've never seen .match() before, time to do some research! Nice solution :)
Fixed for Python
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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 did it with memoization on Ruby: maybe are you trying a wrong approach? Feel free to ask if you think I may offer some tip or suggestion :)
Recursion is too slow/heavy for bigger numbers, while I don't know any way around the math approach (I assume you mean using a Binet-like formula).
Sorry that no one answered this question before. It's a nice kata.
When you're editing your kata, there are four different tabs in the lower left:
"Complete solution" needs to contain your solution and needs to pass all your tests for the kata to be valid.
"Initial solution" should not be empty, but contain a skeleton that the user can start coding in. Normally, you would just put an empty method here with the correct name.
"Preloaded" can contain code that is accessible to the user when solving the kata. But since the user can't see this code, you need to document it in your description. It's mostly empty.
Note that when you run the tests, they are run against whatever code you have active in this window. So before you save your kata, run your tests against the "Complete solution."
Let me know if you have any more questions and I'll try to answer them as well. :-)
Solving this in Ruby:
Recursion: passed tests, timed out on submit
Memoization: passed tests, timed out on submit
Math: passed tests, passed all submits except very high values (where I am assuming floating point becomes inaccurate)
So basically, a challenging Kata (for me anyway :)) ... I'm tempted to look at the solutions but also want the satisfaction of solving this on my own. Any hints on the right direction? Is there an approach I am missing?
Nice solution.
It helped me find some missing test cases. (sorry)
But thanks.
Fun kata. My original brute-force algorithm was too slow so I had to think about this one a bit. Thanks for the challenge :)
I have few katas back here at my computer but I'm not uploading them on CW right now, I'm waiting to learn a new thing with
String.prototype.replace()
and use it in them and then I will upload all the related katas at the same time as The katas from #12 to #15 are related to each other.No worries & I have done multiple of your series! Keep them coming, I will upvote.
Loading more items...