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.
Why are we writing '% 256' in these two lines:
And why did he make an 'l' variable inside of for loop? I don't think it's necessary?
can someone explain this code please
One note about the description. What is the range of n?
There are two statements about n within the description.
One saying:
You can assume that the range of n will be [1, 50]
And one saying
0 < n < 50
Both statements are not the same, since one includes the 50 and one does not.
You really don't need isFirstWord, because callback in map also always gets the index as second argument. So you can check for i===0.
This comment is hidden because it contains spoiler information about the solution
I think always calculating the losers (and the
least_votes
) is not preferable speed wise, although it makes it quite concise.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I posted this solution on Coderwall once. Although I would never use this. It's slow and obfuscates what is happening. But it's fun.
Hehe, I have the same solution. I suppose, it is a flaw in test cases, because although this passes all given tests, It will change all elements within the array to being strings (and null values being empty strings).