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.
Actually it's in constraints that numbers will be ints, so unecessary for kata solution.
If the solution it's here means it passes the tests so either you or the kata are wrong, not the algorithm.
This comment is hidden because it contains spoiler information about the solution
So python have and don't have type coercion
I reached the conclusion (first sort) || (second sort), but I'm not sure why. Do someone care to explain why it works this way?
Thing is you should be aware if you CAN or CAN'T change the original array. As a good practice we always copy the original to another before doing any changes, but there will always be situations where you don't need to do that.
I tryed to do this, but didn't know how to syntax it. Now I know. :D
If did that, than you should be proud of yourself. Constructing a algorithm to treat string dates ins't something trivial.
You're right. Reduce method requires a initial value, when not declared it assumes 0 but it can get nasty really quick.
This comment is hidden because it contains spoiler information about the solution
Observation: though the kata description don't ask for it, it's a good practice to copy the original array and work with it, since the sort method mutate the original array. I like to copy the original with slice method before applying any other method to the array.
Really cool, I liked the way it is compact. The only note is that the regex /\d/ won't find characters like '?', ';', '.' and so on. Luckily there aren't tests to that, but, just in case, I used /[^a-z ]/gi so it will find anything that's not a letter or a blank space.
This comment is hidden because it contains spoiler information about the solution
That's a good point, but code tracing is something that every wannabe developer should be aware of. If you will need the original arg in any other place in your code, you can't mutate it and if not, that's not a thing. This is something that should be learned at a very early stage of coding.
As codes are abstractions, you ALWAYS should be AWARE of the CONTEXT where it is inserted.
This is the best solution i've seem so far :D