• ###### blinker345678commented on "Moving Zeros To The End" python solution

Try it with bitwise operator ~ since it flips the sign bit and makes 0 (+0b00000000)-> -1 (-0b00000000) it almost seems perfect for reverse indexes.

• ###### blinker345678commented on "Subsequence Product Sum" kata

So brute forcing the sum of the products of itertools.combinations times out from the first random test...
takes 6,000ms to build test cases....
max array length = 100,000, max subsequence length = 20...
all just a little ominous...so this is another number theory one...

• ###### blinker345678commented on "Grid index" python solution

This comment is hidden because it contains spoiler information about the solution

• ###### anter69commented on "Grid index" python solution

This comment is hidden because it contains spoiler information about the solution

• ###### blinker345678commented on "Grid index" python solution

How?
what does the [] cause to change?

• ###### blinker345678commented on "Split Strings" python solution

It took me a little while to figure out how this worked but it's quite effective, I'd not considered using iter in that way before.

• ###### blinker345678commented on "Split Strings" python solution

This comment is hidden because it contains spoiler information about the solution

• ###### Weemäncommented on "Split Strings" python solution

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.

• ###### blinker345678commented on "Split Strings" python solution

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

• ###### blinker345678commented on "Split Strings" python solution

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

• ###### blinker345678commented on "Learn Python #1: Variables" kata

The description seems a little data minerish?
Trivial as it might be I'd rather not see people revealing their real names and ages because of naivete and lack of cynicism.

• ###### blinker345678commented on "Split Strings" python solution

concatennating s with _ for every single iteration seems costly

• ###### blinker345678commented on "Single character palindromes II" python solution

I was bugging my way through a slicing solution that cut it into three parts for an hour or four here and there, so it's a little galling that such a simple solution exists...

• ###### blinker345678commented on "Finish Guess the Number Game" kata

For an 8kyu this was unnecessarily confusing. It can't be given a higher rating so I'll summarise it since Classes and error messages are confusing enough for a fool like me.
(under python)
Esentially it's asking you to modify the class so that:
-the player attempts to guess a number and has a specified amount of lives with which to do so
-if the player guesses correctly return True
-if the guess is incorrect it should return False and the player loses a life
-if the player tries to guess again after losing all their lives, raise an error message

The first parts are fairly simple but the last part seems to catch people off guard.
The docs are kind of a confusing mess for this too at first if you aren't familiar with errors and exception handling whuch 8kyu newbies probably won't be, but here are two essentials.
https://docs.python.org/3/tutorial/errors.html#raising-exceptions
https://docs.python.org/3/library/exceptions.html
In summary you work out how to use raise to present an error message.

And for the trivia conscious "Omae wa mo shindeiru" is a famous quote from the popular Japanese manga and anime series "Fist of the North Star" and translates as "You're already dead".