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.
Shouldn't the sequence start with two of the highest values in your memoization container instead of (1,1)?
Frankly, all solutions here I saw but for 54d7ac's one (mathematically optimal, but won't scale to big integers, transformation matrix is better for that, although brings O(log(n)) instead of O(1)) are heavily suboptimal anyway so it depends what you aim for. ;) I aimed for Iterator approach.
This comment is hidden because it contains spoiler information about the solution
Cheating, it doesn't work for any m >= 200. :-/
My solution in Nim passes all the tests but, oddly, the button doesn't change to Submit Final.
Just like you use
div
operator, usemod
. It's much more natural than unsigned-mod%%
operator.x.toInt
does the same asround(x).int
but is shorter and (probably) more efficient.Use
a div b
for integer division, notint(a / b)
.Probably better than my own little obsession, namely: "I know it already passes tests but I can make it better composed/more general/nicer to read". ;)
I felt it's a bit un-pytonish to actually add methods to an existing class without no real reason.
That's probably what "clever" was supposed to mean on Codewars. ^^"
You're welcome. :) I enjoyed it so I'd like to translate other similar katas in the future.
No, it's a mistake, thank you for pointing it out. They were meant to be equal to 100 and 1000. I've corrected it.
Seems inefficient but shows how modular arithmetic works. And it does it well.
The problem is still there.
Loading more items...