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 got a problem when it was -1, it said to be equal to 0 but I already have a code for that then still facing the same problem
Lua Translation
This comment is hidden because it contains spoiler information about the solution
The program is checking floor 0, as per your discription floor 0 or ground floor is callced floor 1 and under ground starts from -ve numbers the checking algoritham is wrong. if i misunderstud the question i am sorry...
Please, try to formulate the description better. I understood that the input arrays are already sorted, but when my tests failed and I printed the arrays, I saw that they are not.
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;
}
}
This comment is hidden because it contains spoiler information about the solution
C++ translation kumited. Have fun!
In a Python sandbox, this function returns the right results but I still fail some tests, I don't understand why.
def merge_arrays(first, *second):
if len(second)>0:
for i, elt in enumerate(second):
if elt not in first:
first += elt
else:
first = list(set(first))
first.sort()
return first
Ruby has one single random test; rather make it 50 or so!
The intended lesson, seeing from the author's solution, is not implemented properly.
Please improve this kata and don't make everyone (including you) delve in the one-way road to hell a.k.a hacks.
Process was terminated. It took longer than 7000ms to complete.
Is this a Kata feature or a CW bug?