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 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.
I did not even think about using map.
I'm impressed... thank you for this code!
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)
.Very awesome code. It seems you are master of Algorithm. Thanks for your code(especially the use of map method)
amazing
This comment is hidden because it contains spoiler information about the solution
Yeesh, why do I always have to make things so complicated.
Strictly speaking, invalid input should lead to an error. We can't assume that 2 an >3 spaces equals to 3 spaces.
why i can't use
MORSE_CODE
.env: node_v10.15.3 or chrome_v74.0.3729.169
I think that Array.join do the iteration by all the array elements.
This means that it's better to create a variables to store decodedWords and decodedMorseCode and concatinate letters/words to them.
Loading more items...