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.
is it neccessary to put '[]' in the min() function?
As stated in other comments, I left it ambiguous on purpose to replicate the ambiguity of the interview testing I underwent, so I think I might stick to the current translation, but thanks for your feed :)
Well, the description clearly states 'you should NOT edit the item constructor/class'. Did you survived the goblin attack?
This comment is hidden because it contains spoiler information about the solution
Last but not least the collection object is injected in your class by reference. This means that other code outside your class can mutate the object by adding/deleting elements. If you counted the elements only once at construction time your result is now out-of-date since somebody else mutated the object which your self.collection points to. So in this case you give false results. To make sure that you always give back the correct result your recalculate len since the state of your collection may have changed. Consider the example below
For the calculation of the len(self.collection) you could be right in this particular example since we never add items to the collection. For a real life scenario we would like to add elements to the collection as well and this would invalidate the number that you calculated in the init. You could use properties to update your calculated lengh variable with every mutation of the collection object and always return the up-to-date calculated value.
For the memory usage you are almost wrong. The collection object is a list which is a mutable object in Python. As a result pass-by-reference is used in the init thus the collection is not copied in the class state. But as I said above in this particular kata we don't add anything to the collection so you could argue that you don't need to save it.