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.
No problem :)
The reason you're getting a memory error is because you're converting a large
range
into a list. However, this is actually unnecessary. You can index arange
object like you would with a list.Once you change that, you no longer get the memory error, but your code times out instead.
thing is, I guess you're limited by the amount of memory CW is allowing you to use, not the amount of memory python is capable to use on your personnal station.
Yeah, thats what I tried too at first. Then I realised:
Something like
n = 1
,m = 2129680158
works instantly. However,n = 1151592177
,m = 2129680158
times out. I haven't really looked at how your code works. But it seems to take longer for a highern
?That's really strange. Your code works, even for the biggest test cases. It may be a codewars issue.
Edit: Ah, ok B4B's reply makes sense.
I just tried your code: it looks like you're consuming all the memory you're allowed to use.
Too many strings instances created, I guess
Sure
Really? What language are you using? I'll test it.
You're printing too much.