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.
Dude , thanks for writing this comment. I'm more silly because I had in the instructions "If the score < 0, return 0" but still came here to check if something is wrong when I get -3
Not once you've been answered.
Well, if your goal was to do it in one line, you definitely got it. I often try for one-line solutions, personally, even though those solutions usually aren't best practice.
"Best practices" doesn't usually mean do the task in as little code as possible, it generally means do the task in a way that is easy for someone else to figure out what you're doing and also to make the code easy to maintain if you have to change it in the future. It's also a best practice to pay attention to performance, and you usually have to balance maintainability with performance.
Your solution could be easier to read. You also end up doing the same work twice by generating the same exact list two separate times. You could just generate one list and pull both the max and min numbers out of it. Having to generate one list would also save you time in the future should you need to change this code. For example, if this were part of a larger project, and your team decided that this method would be passed a list of ints instead of a string, right now you've got two changes to make in your code, but if you'd done it the other way, you'd only have to make one change.
I wouldn't put TOO much stock in the answers that are the highest upvoted for "best practices". People often upvote solutions that work, but are not "best practices", either because the solution was funny, or clever(even though there's a separate upvote for that), or the solution is very short, or any number of other reasons. I've seen incredibly inefficient code get the top spot for "best practices" before (like n^2 time complexity where an n or even a 1 time complexity could be achieved).
You'll have tell us which programming language you are using, or else we can't see your solution.
Otherwise if you just want to see other peoples solutions to the kata, you can check the Solutions tab. There you will find all user submitted solutions and rate or comment on them.
The most voted best practice and clever solutions will be listed at the top.
No, it's fine.