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.
@benbrnpetit for larger datasets push will be more performant than unshifting. When you add an element to the end of an array, it can be done instantly. When you unshift and array, you must move the entire array forward, which takes more time with larger arrays of data
how? or this sarcasm?
Nice and simple solution) Cool!
This comment is hidden because it contains spoiler information about the solution
soo dumb!
may be a stupid question of a JS beginner but - why there is 'i < data.length' instead of 'i < data.length - 7'?
Nice use of spread syntax.
console.time() gives me around 0.115ms for both methods.
exactly
from the end through the push will be faster
This type of thing is often the best solution to a problem!
No worries, I can translate to haskell and ruby if you are looking for translations, just send me a message on gitter.
Thank you! I appreciate the advice very much. I'll try to think of a better way to make this problem something different (and I'll probably unpublish it if I can't, and work on something else of course).
johnoro,
There are a lot of great people on CW who are open, friendly and very helpful. Don't let the few who are otherwise actually influence your decisions, just focus on the postive and ignore the rest.
It isn't easy to avoid duplicates, especially if you are not a very experienced programmer because
There are lots of mathy things which have various names, and no one uses all of them in the description so it is easy to write a duplicate kata because no one used the same key words you used.
There are also some users who will flag things as duplicates if you use the same general algorithm, but for a beginner, or even intermediate programmer that might not even be evident if you were to actually have the other kata in front of you.
It might not be as much work as you think to republish/publish a kata because you can just use one as the starting point for another, and all the work you go into developing the test package makes the next one that much easier as you can save/reused parts.
Reworking a kata often is pointless because if even you rework it, the up front heavy negative votes will keep it in Beta because users rarely come back to see if they should change their vote.
The best way to actually avoid the duplicate charge is to actually come up with an original problem :
This is also the most beneficial for you as it really will cement it in your mind. However it is also the hardest and most involved kata to make, hence why it isn't that common. A lot of the kata are just restatements of problems found in algorithm books (minimum string distance, or come from other sites like project euler, etc.).
If you are an avid blog reader it might be a source because people often talk about new things there and that can give you ideas which are not often published. But the ideal solution really is to see the writing process as just another way you learn, see the effort you make as being of benefit to you and not getting attached to the result of publishing / voting.
Loading more items...