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.
I tried indices as well, but didn't work anyway
My guess is as good as yours (haven't solved the kata). But I think the sum of those indices is the answer.
Don't open another issue if it is about the same problem.
I asked too :)
tf is 11 ?
where did exactly 11 come from in this part?
arr = [17, 12, 5, 6, 13, 3] where length is 6.
solution says:
this would return 7 due to
(170 + 52 + 134 + 35) / 11 = 7.
what is 11? shouldn't it be (170 + 52 + 134 + 35) / 4?
arr length is 6, primes length is 4, the only match i found is
5 + 4 + 2 + 0 = 11 (indexes)
I'm afraid novel ideas concerning primes are hard to come up with. There are already numerous similar kata's on codewars, hence it's a duplicate.
It was a division by zero in my code ;)
Are you sure?
1 / 2^50
is really small...The reference solution is incorrect. It guesses for primes and has yielded incorrect guesses during my attempts.
Excellent! I read this approach in the wiki, but seemed a bit complex and went with the 6k +- 1 optimization. Later I will check your implementation and see if I can understand it. Thanks.
Not Sure if you still need an answer but the problem is that you are declaring your list in the class and never clear it, so on the first test i assume that your programm works but on the second one he is just adding things to the list of the last test and that is what gets you this weird solutions. try it again and write as first line in the singlePermutations method: "list.clear();" so the list is empty when you start a new test. Hope i could help :)