Ad
  • Custom User Avatar

    Ah crap, cheers I completely misunderstood that. Saved me some more time

  • Default User Avatar

    I could have used .format method OR f string literals....but I didn't

  • Default User Avatar

    Hi @alex__c, granted, it may not be in the examples, but the Remarks portion of the directions do tell us that a 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!

  • Default User Avatar

    You can use the equality operator (==) with the null keyword. So, if (a == null) { do things differently }

  • Default User Avatar

    @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.

  • Default User Avatar

    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

  • Default User Avatar

    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;
    }

  • Custom User Avatar
  • Default User Avatar

    hobovsky, I do it in Java. Why it is wrong?
    if((a.length == 0) && (b.length == 0)){
    return true;
    }

    I tryed && and & - nothing helps

  • Custom User Avatar

    ((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.

  • Default User Avatar

    no need to use abs. do not do it

  • Default User Avatar

    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??

  • Default User Avatar

    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:

  • Default User Avatar

    11 squared is 121, do the math

  • Default User Avatar
  • Loading more items...