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.
https://www.codewars.com/kumite/new?group_id=6699152a7a7df3fa557fc453&review_id=6699138f7a7df3fa557fc3ff
Yes this helps, thank you
For 42 pieces you have 3 options since we are not including side length 1:
2 * 21
this option gives 0 inner pieces since every piece has a flat side. Therefore inner - outer = -42 . . .
3 * 14
This time the inner pieces are 1 * 12 which is 12. Total outer pieces are 30. so inner - outer = -18
6 * 7 . . .
there are 4 * 5 inner pieces for 20 inner and thus 22 outer pieces. 20 - 22 = -2
Most negative difference is -42 and most positive difference is -2 as it is the most positive of all of the options. Hope that helps.
So how do you explain this? Where does -42 and -2 come from?
This issue should now be fixed with the tests, but if I still have it incorrect and your solution is giving you difficulty just reply and I will get on it ASAP.
This kata is about calculating the most negative possible difference between the number of outer pieces of a jigsaw and the inner most pieces of a jigsaw as well as the most positive. Since for example a 42 piece jigsaw can have four sets of dimensions (3 x 7, 2 x 21, 6 x 7 or 1 x 42). It just asks what is the greatest possible difference in both the negative and positive sense.
In other words, what is the smallest number of inner pieces to greatest number of outer pieces for most negative.
What is the greatest number of inner pieces to smallest number of outer pieces for most post positive.
I will add images (soon) to help explain in instructions.
I don't understand the specification. What is this kata about?
Don't close the issue if you don't know what the issue is..
You can always ask for more explanation..
Problem acknowledged. I am now looking into the cause and a solution will be found in the next hour.
Edit: Problem is in original solution, code section:
// Second the most postive will be when the sides are matching in length most closely
let firstSide = 1;
let secondSide = 1;
for (let i = decompositionPrimes.length - 1 ; i >= 0 ; i--){
if (firstSide > secondSide){
secondSide *= decompositionPrimes[i];
} else {
firstSide *= decompositionPrimes[i];
}
}
I am currently looking at solving this issue.
Random tests sometimes ecpect wrong results, e.g.:
Reference solution probably use a 33x75 puzzle with 2263 internal and 212 external pieces, but the puzzle can be 45x55 with 2279 internal and 196 external pieces.
Random testing should have removed this as an issue. If I am incorrect please tell do tell me.
True
result, leading to solutions like mine and the one mentioned below.Don't know what the issue is, should work
Thank you. I will edit to be randomised tests.
Loading more items...