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.
Have you actually tried testing that claim? I've tested 5 solutions (mine, the linq solution commented on, yours and two others from this comment thread). Only one commenter I tested in this thread (zokeer) has a solution that actually runs faster than the Linq solutions (though at least all the solutions run in linear time against varying string lengths and varying unique character amounts). Both yours and Zub_Son's are slower than the Linq solutions despite commenting on the alleged slowness of it.
Not only are the Linq solutions easier to write and read, this shows that most people trying to make faster/more optimized solutions end up slower than the naive Linq one. Add in that such optimizations aren't really necessary unless the method is an a hot path and I'll prefer a competently written short Linq solution 90% of the time.
Both your and this solution run in linear time, so I'm not sure why you'd think this is inefficient in terms O-Notation. Your solution is roughly two times faster than both this and my Linq solution in my tests (string length of 650, 6500 and 65000) but all three solutions scale linearly. The Linq solutions also allocate more space but unless this function represents a performance bottleneck I would 100% prefer a short and easy to read/write Linq expression over doing it by hand.
wouldn't it be better to move parseInt to reduce by removing the extra loop? With four loops, this solution doesn't seem Best Practices
ngl this is the most readable and clean version in my opinion. My only issue with it is that at a glance it looks like you're reversing a string and then making it inot an array just so you can make it into a different string. It feel like an extra step but is it cus string(the type) is immutable?
This comment is hidden because it contains spoiler information about the solution
I seriously need to go study Regex more
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Briliant =)
i think so
The most concise version!
'g' instructs the function to remove all alphabets, not just the first one.
I could win a gold medal in the olympic 100m dash, but the other guys keep cheating by running faster than me. Life sure is cruel.
This comment is hidden because it contains spoiler information about the solution
genius
Loading more items...