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.
Depends on the situation and constraints
Actually, your solution is DRY in the runtime sense but the solution above is actually more DRY in terms of code since you don't have to repeat certain things.
Out of curiousity why is this a code smell? Case/when seems like a natural solution to this particular problem.
which is why this is predominantly voted a clever solution
I hope you know what a sense of humor is
I think your argument would be valid if we were dealing with unknown length of the array but here the length is fixed making the complexty time constant.