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.
This is bad in terms of time and performance, because you will have to traverse the array 2 times.
you should update your solution because, it's not valid after some added test cases,
it is called prefix increment
As of January 21, 2025, padStart is experimental. I don't think using it is a good practice. Regarding min/max: a variant with normal conditions (see my solution) would be more readable
Regular expressions
How does this work? Why the gi in the regex? I am just learning regex.
|
is technically the bitwise OR operator, while||
is the logical OR. The first one works with the binary representation of the values being compared (coerced to numbers), while the second one works directly with the values being compared.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR
This comment has been deleted.
Wow. This is one of the few low-level katas where thinking of how to make a one-liner is not so easy.
brilliant solution
thanks for including formula name I collect these lol
I honestly prefer doing it this was as with functions as objects they seem too complex
This comment is hidden because it contains spoiler information about the solution
The time complexity of the algorithm in this solution is O(n² log n).
Kata stipulates "an array with exactly 5 strings". Not great for general use, but meets the requirements of the kata.
Loading more items...