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.
thanks for showing the correct way to use .sort() for this problem!
unfortunately .sort() will not work properly because it will sort 10 ahead of 2.
will it work then if we add a function to sort? to be sorted numericaly?!
sides.sort((a,b)=> a>b ? 1: -1);
Fixed
This is something called regex which is a handy string manipulation module used in nearly all programming languages (Python, JavaScript, Java, C++ etc). It's very useful and I recommend learning it in the future. If you scroll down to the other comments you can see some information about this solution, and a step by step working of it from
@bkaes
.This comment is hidden because it contains spoiler information about the solution
Great explanation, trying to learn regex as well, could you explain '$1 ' as well? I've seen some explanations but I am not fully sure how to interpret and your prior explanation cleared things up for the first part of the statement. Thanks!
Great explanation, trying to learn regex as well, could you explain '$1 ' as well? I've seen some explanations but I am not fully sure how to interpret and your prior explanation cleared things up for the first part of the statement. Thanks!
Description states input will be HH:MM but in the random test on submission I was getting input that was 5:11 which has only a single digit hour. Practice tests show 08:15 which was expected.