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.
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.
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
So I agree that your solution works ( I didn't get the answer right myself ), and this is great stuff. I guess the answer to your question about the loops is the fact that there wasn't a guarantee (at first viewing) that looping thru just once would guarantee the optimal solution.
Great solution. I am a beginner in computer science can someone please confirm that the time complexity is O(3n * len(letters)) and if not could you explain me why? Many thanks
Thanks for this kata. I found it very challenging to keep track of whether starting zeros are OK or not, depending on where we are in the computation. I wonder if I missed an obvious optimization.
Yes, there is a similarity there. That one didn't show up when I was searching for possible duplicates before publishing. However, it appears there are significant differences that distinguish between the two so they wouldn't be duplicates.
Similar to https://www.codewars.com/kata/challenge-fun-number-19-black-hole/discuss/javascript ...
It's a nice kata but I found it quite difficult to understand the instructions. I prefer very simple instructions that give rise to a difficult problem :) But still thanks for this!
Is the "somewhat satisfied" vote due to the ranking? Because I have no control over that.
I think this is harder than 5-kyu
nice! ;)
This comment is hidden because it contains spoiler information about the solution
How about reducing the numbers of loop: len(letters) to its half?
I have absolutely no background in programming I had just learnt python from codecademy.com and somehow came across codewars to practise what I have learnt. I managed to reach 5kyu, so this question may sound silly but can someone explain the 2nd and 3rd line of the code, what does it exactly do?
Loading more items...