This algorithm is a masterpiece, congratulations!
hey bro. i cant understand this...
I don't understand why there are 74 BP for an inefficent solution when there are way better solutions submitted. Not insulting the code, I did the same thing before realising the loop was unessesary.
This will run indefinitely in case window <= 0;
This comment is hidden because it contains spoiler information about the solution
The largest number of katas I could not solve (at least on the first try and it did take some time to improve an approach and coding skills to give it a try again after a while) is for katas from g964. A crazy stuff for me. =)
It's actually surprising that a "loop solution" did pass a kata from g964 that can be simplified to avoid the loop. This is so much "not his style" ! ;-)
Well, it's only 6 kyu, right...
learn a lot, appreciate.
I began with "count+=2" inside the while loop without the inner if statement and "return count+1".... Didn't think about starting count at -1, thanks!
You can also just start count at -1 and always add 2 within the while loop, which allows you to remove the inner if statement.
Starting at -1 means you can always just return count without the "or -1" too.
Alternatively: start count at 0, again remove the inner if and the "or -1", and do "count -= 1" after the while.
What is your time Complexity?