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.
"Given a number n, return the
number of positive odd numbers
below n, EASY!"Comparison of null values required . (OP solved it, closing)
Thank you. I've got it.
RTFM Kata Rule:
Do not modify the ONE_HUNDRED declaration
Just ONE_HUNDRED being uppercase should be final.
What would happen if "int n == -15", for example?.. Where is the checking for positive/negative int?
This comment is hidden because it contains spoiler information about the solution
In such a release when (nb_petals == 516) the result is "I love you" while it should be "not at all"...
If you please, can someone explain me in detail why all the tests are passed, but random tests - are not. It's not the only kata when it happens and I don't know how to check it without clean understanding the characters of the tests that I don't see. Please.
import java.util.ArrayList;
import java.util.Arrays;
public class Kata {
public static int[] mergeArrays(int[] first, int[] second) {
ArrayList list = new ArrayList();
for(int i = 0; i < first.length; i++) {
list.add(first[i]);
}
for(int i = 0; i < second.length; i++) {
list.add(second[i]);
}
for(int i = 0; i < list.size()-1; i++) {
for(int j = list.size()-1; j > i+1; j--) {
if(list.get(j) == list.get(i)) list.remove(j);
}
}
int[] result = new int[list.size()];
for(int i = 0; i < result.length; i++) {
result[i] = (int) list.get(i);
}
Arrays.sort(result);
return result;
}
}
Yes, you're right. Thank you so much! I've corrected them.
Read carefully the sample tests, there is more than one bug still in your code.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Please, next time you post code, mark your post as having spoiler content. About your code, your last line should work but I don't know where you wrote it (read the next sentence). Then you typed the input and another error appears because of that.
This comment is hidden because it contains spoiler information about the solution
Loading more items...