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 comment is hidden because it contains spoiler information about the solution
This solution doesn't consider dirty inputs.
Callbacks instead of anon functions make this solution more readable.
Drawback to this solution is its O(n^2 or n * m) performance when it can be done in O(n).
Nice and readable!
But I think the questions also a Note ···−−−··· should be treated as a single word and should have a word as SOS seperately.
So, what if I input the morse as '.... . ._ .___ .._ _.. . ···−−−···' => HEY JUDE SOS
but this code will return me HEY JUDESOS
Ooh, Seeing solutions with a few lines I feel like a retard.
Empty your mind.
Now recursion can flow or it can crash.
Be recursion, my friend)))
I did not even think about using map.
I'm impressed... thank you for this code!
This comment is hidden because it contains spoiler information about the solution
how did 0 + 3 + 2 + 1 equal to 5?
thank you
map
creates a new array populated with the results of calling a provided function on every element in the calling array. SO assuming you have a function -operation
and an array [1,2,3,null], the map method will runoperation(1)
,operation(2)
,operation(3)
,operation(null)
.Coming from Haskell, I find it hard to use loops (even though I've used JavaScript for two years before learning Haskell). When I started solving katas in JavaScript, I kept on trying to use recursion instead of loops because it was faster. But soon learnt that it's not.
Very awesome code. It seems you are master of Algorithm. Thanks for your code(especially the use of map method)
Loading more items...