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.
Well four years later and there are still people (like me) running into this problem. There's even a test case testing for n=250k...
But I think that's a good thing, as I've learned something from that.
I had to look up other people's solutions. As it turns out the only difference to my solution was a cast to double. Without the cast I had a ratio [1] resulting from the division of two integers. And it seems like summing up a bunch of ratios is very inefficient.
[1] https://clojure.org/reference/data_structures#_ratio
Yeah, there's a test case that asks it to be calculated on n = 25000, which takes a looooong time. I've tried optimizing it several ways and it still always times out
I'm having the same issue. I don't know what the value of
n
is for the test which times out, but on my machine I can go up to ~3500:I believe the code is right, as it solves a case which the author has provided an answer in a comment here:
Thank you very much)))
Sorry I cannot help you with it, I don't know Clojure. But I'll try to notify the translator about this.
Lang: Clojure
All the tests passed, but when I'm trying to submit a solution, process terminates, because it took more than 10000ms to complete task. Well, I've tried several versions of solution, in case of making the programm more lightweight, but result is the same. What's the problem?