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.
Iterating is usually better practice than indexing if possible, as it has fewer failure points (though in this case it's trivially fine):
for (i, n) in arr.iter().enumerate() {
till 1 will serve 2 then 10
till 2 - 3 then 2
total time - 12
There is no need for complicated concepts. Try to solve simple case on paper first. E.g ([1, 1, 2, 3], 2) == 4