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.
Thanks!
Very good kata. I had a lot of fun :)
;-)
Arrggggg !
it was so easy. (by the way on my laptop it just divided the exec time by 7 )
Thanks a lot for your support
You've basically got the correct solution. I think you are spending too much time on
n % 2 == 0
. Try to think of alternative ways of testing for odd or even. May-be precompute/get all the bits ofn
in one operation. A number is stored in binary, isn't it? No need to recompute the bits.Description is a little confusing, did not understand the example was the function to study :)
Nice kata
Ouchh it hurts :(
My code is based on the F(A,B,n) function which can be evaluated depending if n is even or odd.
Is there any optimisation on top of that ?
My solution calculates
fusc(1 << 100000)
in18 ms
. Your code is super inefficient.perhaps, but I tried just "return 0" as the code of my function, I have only one test and it lasted 5 ms!
And it seems that there is only one test (unless the global test failes if a single test failes ? )
by the way my function is O(log(n)) and on my laptop fusc( 1 << 100000 ) runs in 2300ms
Yeah, I know it's frustrating. I just ran my own solution and it completed in under 5s so I don't think you can only blame the server.
Python timeouts
Python test is allways failling with a timeout.
it is very frustrating as locally on my laptop it is OK (with the implementation of the F(a,b,n) function)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
OK done, I tried the last approach I was avoiding on purpose :) !!.
but the final test failed many times with timeout before passing in 4500ms... strange ?
This is simplified version of the kata. Bruteforce should be enough to pass all the tests. Either optimize or find another approach. And yes, there are many approaches, as you can see in harder version of the kata.
Loading more items...