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 :)
Yeah, figured this out. Removed those bits from my code now... Thanks for the help! :)
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.
This comment is hidden because it contains spoiler information about the solution
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
?@Avanta: I have tried my code on huge numbers that would normally cause memory limits on Python... like n, m being 1, 9223372036854775807 and it works in an instant.
I am really confused now with this error 137... Can't think of a case which would cause MLE.
Thanks for trying my code... So error 137 means MemoryLimitExceeded?
I am not sure how it could happen in my case as I am discarding many numbers that are not needed... I can't even print the case for which this is happening, so I may have to try totally different approach. :/
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
This comment is hidden because it contains spoiler information about the solution
Sure
Happens on all versions of Python. I can give a pastebin link to the code if that helps.
Really? What language are you using? I'll test it.
Thanks for the reply... But this happens even when I am not printing anything?!
Loading more items...