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.
Incredible. 0.003 seconds to compute S(1000, 1000) in my Jupyter notebook, whereas numpy solutions take nearly 9x that long. Apparently I need to research this to understand how it works.
I had to have ChatGPT walk me through the Lisp syntax since I've never worked with Lisp before.
Memoization via a stream isn't good enough to solve this kata. You'll have to study the link provided in the description.
Check the hint link in the description. You're supposed to reach for a better algorithm, not just memoize.
Probably need
return fib(n,arrayer,indexer)
I thought for sure that Binet's Formula would be the fastest approach. It's a single formula! Constant time, one and done! But you have to use the Decimal data type to accommodate the required precision, and the precision increases linearly with n, so it's actually O(n) time. In contrast, the matrix exponentiation approach is so blazingly fast that I have to repeat the operation 10,000 times for different values of n just to get a meaningful measure of how fast it is. I am completely blown away. Clearly I need to git good at matrix math.
Thanks; I hate it.
Very interesting approach; thanks. The downside is that you are recalculating progress and rank every time you access them, though this would make sense if you expect to access them less often than you increase them. (Also probably negligible performance implications in practice anyway.)
Just trying to avoid the timeout by avoiding redundant calculations across many tests.
Wow. So elegant, yet so counterintuitive!
Wow.
Just keep in mind the following:
Nice. I've seen the chained comparators with inequalities, but not equalities. Now that I see it, it's obvious that it would work. Just never thought of it before.
Neat!
This comment is hidden because it contains spoiler information about the solution
Loading more items...