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.
Thanks for the advice, i'm new on this website.
What is considered a spoiler?
I thought about it before posting it but since the solution was provided, i didn't think it could be an issue, i guess i was wrong :p
Please use a spoiler flag, comments are visible by default to everyone (I put the flag for you this time).
This comment is hidden because it contains spoiler information about the solution
thx! :) (Note: do not forget the spoiler flag, when you throw bits of code in the comments: they are visible from anyone in their dashboard)
This comment is hidden because it contains spoiler information about the solution
What list lengths were tested? If it's function calls that are expensive, it's still a constant factor, it may be able to significantly affect times for only really small lists.
@KenKamau: I understand. Don't get me wrong, this wasn't meant as criticism, just as a fun little observation in case other users wondered if and how the two top voted solutions differed.
@Unnammed: My comment was based on the following timeit results (first fct is sum(arr1+arr2):
So as you can see the performance difference is very small, but it's there. My best guess is that's caused by the additional function call which to my knowledge can be pretty expensive in Python.
Proof? I don't believe adding numbers can be slower than adding the same numbers and allocating memory for a whole list and copying everything.
It's 8 Kyu. I don't think about performance in such Katas.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution