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.
Please add test for if there is space left in Java code;
Could you please add test cases (sample and submit) that verify the rounding to 2 decimals condition of the Kata.
This solution, as the most, do not fullfill the condition of rounding to 2 decimal points.
There is no test input checking for that so no one realice it...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The condition part in the for loop will evaluated on each loop.
So if you need a calculation (with not changing values) like here it's better to do that before loop, save it in a variable and check against that variable.
The compiler may optimize that for you, but thats not guaranteed.
This comment is hidden because it contains spoiler information about the solution
It's not my Kata so I cannot edit it, but I add a suggestion for adding this tests.
(it seams that editing is not possible for me/my honor?)
Could you please add this test cases, as there are solutions with sum the values that resulting in false positives. (test11 prevent sqrt sum, test12 prevent pow sum)
@Test
public void test11() {
assertEquals(false, AreSame.comp(new int[]{3, 10, 15}, new int[]{33, 99, 16*16}));
}
@Test
public void test12() {
assertEquals(false, AreSame.comp(new int[]{1, 3, 3, 9}, new int[]{11, 11, 77, 77}));
}
The commented thesis is correct.
But this solution will have false positives for some inputs e.g.
AreSame.comp(new int[]{1, 3, 3, 9}, new int[]{1*1, 1*1, 7*7, 7*7});
As there is no check of same amount of entries also for e.g.
AreSame.comp(new int[]{3, 4}, new int[]{5*5});
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Because of possible big numbers you should map it to long(or double as returned) not int.
As the result of the function is a long big numbers can be assumed.
This comment is hidden because it contains spoiler information about the solution