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.
very interesting
clever code
really clever, well done!
so clever
deque in this situation is miles faster than normal lists
The idea is that we calc each next number manually; we know that next number is one of 3 possible routes: to increase 1st expo, 2nd or 3rd by 1. So we calc all 3 numbers (what they will become with increased expo and pick minimal), we increase expos of taken step, save number and repeat all again.
You may not a beginner anymore, but I think the complexity of this is O(n^2) where n is the len of the secret.
I use "triplets * 2" have passed.
but i don't know why use it.
Is there a compelling reason for calling that particular identifier "expos"?
This comment is hidden because it contains spoiler information about the solution
This solution is actually fast. I ran double(30, 20000) for the above solution and my solution without the "if b > 0.00000000001" part. my solution took 565ms wheras above solution took 165ms.same code but way faster.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
letters is a list of all the different letters in the string, and the for loop is just repeatedly looking a the triplets
eg. if triplets=[[1,2],[3,4]] then letters is a list containing 1,2,3,4 in any order, and t will be [1,2] and [3,4], 4 times each
few lines but not so efficient
Loading more items...