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.
So? Still
O(1)
.yeah it's a mess
it also looks cooler
You are right, in general. But theoretically, if we are in environment which is restricted by RAM, additional memory allocations sometimes are not desired. Secondly, perhaps authors supposed that caller code is responsible for immutability, by cloning passed arrays, for example. Lastly, cleverness also counts, and sometimes we're sacrificing best practicing for higher cleverness (less code in current case). 😉