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.
clean, but the intital split/filter repetition seems a bit high in performance cost and very reduceable.
chatGpt gave me same answer when i tried to find a better solution
im working on this solution some how i forgot to put'...' in front of arr
nice and beautiful solution!
20 lines? 🙂
Pretty clean, love it
Or you could just use a.localeCompare(b) instead of trying to find the index.Misread that.I'd say the best say is
[...'abcdefghijklmnopqrstuvwxyz']
omfg i did't even thought about it, its so obvious...
The right hand side of the
||
is only evaluated if the left hand side is zero (a falsy value). So the sorting prioritizescount
(objects with higher count come first), and when bothcount
s are equal, the next condition is used (alphabetical sorting, bysrc
and then bychar
).kind of slow tho :c
can somebody explain me, what exactly happening or we doing in the sort after
||
or after the OR part?Nice usage of ternary operator and sort method. I learned a lot from this solution, thanks.
I don't understand why you think this is good solution. You have to cycle for every alpabeth character (no matter if it present in the strings) and then you have to loop through each string to check if that character belongs to it. I don't see this as good performance. There is a trend here that nested functions are always the solution and, while they have their beauty, sometimes shouldn't be consider as a choice to solve a problem.
He is rigth.. remember char '-' in the string
thanks dude... and nice solution..
Loading more items...