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.
to be honest the most part of that algorythm was found on the net. I just modified it a bit to improve the performance. But it's like life , you start from known bases and you improve it ;).
I love the performance on this! It's really efficient, and inspiring!
the prob is that you gave code not only definition. That code mislead me because I naively think you wanted we used that code. Perhaps just give only definition and not code or precise that the code you give is not efficient on CW web site (btw that code is perfectively fine on my computer even with very big number)
This comment is hidden because it contains spoiler information about the solution
@hobovsky : when i say i use python 3.8 it was on my computer not on teh web site. I also think you have misunderstood me : I had the timeout message on the 'Test' when you obviously show me the 'Attempt' result.
Test use 17 tests : .
@ecolban : you are a naughty boy. I finally understand where come the message of 'Times out' = that comes from your code to caculate totients (G = {i for i in range(1, m) if gcd(i, m) == 1}). If i used anotehr method all is good
FYI, I just reran one of my past solutions, which completed the 200 tests in less than a second on the server.
I wonder what we two do differently, because first of all, Python 3.8 version is unavailable for me here on CW, I can select only 3.6. When I do so, I submit following dummy solution:
what obviously makes all tests fail, but it gives some potentially useful output which I pasted here. It's not really interesting except last ~30 cases with big numbers, which you could use for benchmarking.
Unfortunately I haven't solved the kata yet so I won't ask you for your code, but if your benchmarks run locally on above inputs efficiently but still timeout on CW, you might want to ask for help on kata solving channel.
Sadly your tips do not work.
when i return 1 and print the args i have only the test case shown in the "'sample test" (around 16 tests) windows and i have already test tehm with success
%%timeit
tower(3,4,1001)
tower(729, 0, 1)
tower(729, 0, 2)
tower(1, 897, 8934279)
tower(3, 3, 25)
tower(2, 2, 1000)
tower(2, 3, 100000)
tower(2, 4, 100000000)
tower(4, 2, 10000000)
tower(4, 3, 10)
tower(7, 1, 5)
tower(28, 3, 25)
tower(28 % 25, 3, 25)
tower(13, 3, 31)
pow(13, tower(13, 2, 31), 31)
tower(13, 3, 31)
pow(13, tower(13, 2, 30), 31)
tower(13, 3, 31)
pow(13, 30 + tower(13, 2, 30), 31)
m = 1001
t_3_3 = 3 ** 3 ** 3
t_3_4 = pow(3, t_3_3, m)
tower(3, 4, m)
t_2_4 = pow(2, 2 ** 2 ** 2)
t_2_5 = pow(2, t_2_4, 720)
t_2_6 = pow(2, 720 + t_2_5, m)
tower(2, 6, m)
=>
10 µs ± 765 ns per loop (mean ± std. dev. of 7 runs, 1 loop each)
I have not solved the kata in Python, but you could try following things:
return 1
should do). All tests will fail, but you will see how many of them is there and what are parameters used. As far as I see, there's 200 test cases.Hi everybody,
I do not understand why I have an "Execution Time Out" when I do the tests on the server since all is fine at home.
I do not use brute force.
when I use the maximum value allowed by the instructions :
tower(int(1e20),int(1e20),10000000)
the result is obtained in 703 ns ± 6.63 ns
When I do all the tests shown in the SampleTests part, the tests are ended in 10 µs ± 765 ns
any idea that can help me solve that Time prob?
I use python 3.8
because in that kata, the restriction aren't the same, that's all. Those are "anti-cheat" measures (not powerful ones...). So what's allowed or not depends on who implemented the restrictions.
I m curious about the effect of "code" as a string on a code. Have you an idea?
BTW the "code" comment was in a solution for another calculator kata's solution I submitted and I did ont have a prob at that time.
thanks for all your answers
Because it's not easy to find out if it's in a comment or not, so it's forbidden everywhere.
it was that. It s really strange condition but its not in instruction. I do not understand why writting "code" in a acommetn is forbidden.
that's because you wrote "code" somewhere in your solution. Possibly in a comment or as part of something else. And that's forbidden by the restrictions.
Loading more items...