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.
That's a good point, however the solution it's OK, it passes the Kata... Right?
Maybe open up a suggestion to add that test case?
I second
Using eval is not a problem if you know what you are doing.
The fact that the line is over 100 characters long. It helps others to read your code when you break it down by logic, just like you break down your speech with pauses. Most programmer's job is not that much of writing your own code, but fixing and optimizing the someone else's existing code. Now, imaging you have to read not a level 8 kata code but FAANG level code written as a 1-mile sentence.
There is a book, programmer's bible, called 'Clean Code' by Robert Martin, I'd really recommend it to everyone who is learning programming.
This comment is hidden because it contains spoiler information about the solution
...but there are other options, so it isn't eval or nothing....
exactly. I also wanted to say that.
Well, it passed the kata, so I'd say that it is a solution. With these things, all we are aiming to do is pass the tests that are given.
It's because I added it for you.
Please use spoiler flag, comments are visible from the dashboard.
In your opinion, what makes this solution unreadable?
its better then nothing
in real live requirements change. The effort of writting both is equivalent and looping an array with 3 elements is not a performance bottleneck so there is a point in doing a loop
Overcomplicated and slower (probably, most likely), but if you are a mathematician it is a complete solution.