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.
there will always be only one or zero occurances of '#' so there will only ever be two strings
I like this. One minor tweak here would be to start
Range
at1
instead of0
since0
will never contribute to a sum, but that just saves you one iteration.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
Pro tip: don't waste your energy trying to up the quality of codewars posts
Bad practice because:
Thanks :-)
nice idea :)
wtf dude...
this site might be inspirational, but it's rarely a good idea to blindly copy code from 99% of the solutions.
Regardless of it being marked as "best practice" or whatnot.
Ok I tested it against 7 other solutions, once I reached string lengths around 30,000 there was a sudden loss of competitiveness from a midling 4th place to last place and three times slower than the next closest, at 300,000 it has reached about 30x worse
I get that it's a coveted oneliner but someone at least ought to point it out before you start cutting up Billion character strings. it's kind of irrelevant at the current scale also it seems like one of the faster one line solutions
https://xkcd.com/1691/
This comment is hidden because it contains spoiler information about the solution
Yes, it seems is shorter code but the operation every cycle could make it slowest.
Loading more items...