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.
Ah crap, cheers I completely misunderstood that. Saved me some more time
I could have used .format method OR f string literals....but I didn't
Hi @alex__c, granted, it may not be in the examples, but the
Remarks
portion of the directions do tell us thata or b might be [] (all languages except R, Shell)
. The word "or" instead of "and" that indicates that they could be different lengths. Best of luck!You can use the equality operator (==) with the null keyword. So, if (a == null) { do things differently }
@Mariam:
After careful consideration, I am fully sure I need to check for the abs() value when sorting, to handle negative numbers in the array. That is not the issue. Thank you for your contribution :)
However, after re-re-checking my logic, I have found a pesky off-by-one error, so I will consider my issue as moot. It wasn't test case 8's fault.
Instead, I have discovered that none of the examples even hint that the arrays might have different sizes, they are the same size in all examples. Another thing to consider....
@Hobovsky:
I have. It would have been more useful if you had directly quoted the parts you thought were relevant for me. In any case, thank you, I guess.
omg, it looks like test case 5 HAS NO array b? Is it possible? What code I have to write to find out did main method passed both arrays or no? I do Java
I have same problem. Cannot pass the test 5 that has two empty arrays. I do check empty arrays in the beggining. It works in IntellijiIdea but doesnt work here.
if((a.length == 0) && (b.length == 0)){
return true;
}
Please read this.
hobovsky, I do it in Java. Why it is wrong?
if((a.length == 0) && (b.length == 0)){
return true;
}
I tryed && and & - nothing helps
((a.length == 0) & (b.length == 0))
: It depends on language, but if this is exactly how you have it in code, then it's most probably wrong.no need to use abs. do not do it
I passed 12 and failed in 1. Cannot pass test 5 with two empty arrays. But I do check length of both arrays and if BOTH of them are 0 I return TRUE ((a.length == 0) & (b.length == 0)) Am I right??
Testcase 8 is strange. The last pair is definitely NOT a root and square pair, the root of 36481 is 191, not 195.
I am printing arrays a and b in ascending order of their abs(values).
Log:
0 0
1 1
-14 196
19 361
144 20736
161 25921
195 36481 <-- ????
expected: but was:
11 squared is 121, do the math
@TommyBran: you could read https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution.
Loading more items...