Ad
  • Custom User Avatar

    It should say "If a AND b are empty the result is evident by itself", meaning "true" because nothing is equal to nothing squared. The problem does not however make sense if one or both arguments are not lists/arrays (i.e. nil/None/null in languages where that can happen).

  • Custom User Avatar

    Then what does "with the same multiplicities" mean? Isn't "multiplicities" the amount? I'm not native English speaker, so excuse me if I misunderstood it.

  • Default User Avatar

    No. Instructions say "Same" means that the elements in b are the same elements in a, squared. Thus, you could say if b = [ 16, 16, 16, 16, 16, 16, 16] and a = [4], this qualifies as "same" since the elements in b are the same as in a, but squared. There is no 1:1 ratio happening and if there is, its extremely poorly worded. Even looking at the first example of valid arrays you see multiples of squares, thus 1:1 cannot be true. And if it was, my solution would fail.

  • Custom User Avatar

    ...whether the two arrays have the "same" elements, with the same multiplicities.

    the same multiplicities - doesn't it mean the same amount for each num and its square?

  • Default User Avatar

    The question doesnt ask for 1:1 though. I am coding mine without doing 1:1 and it works fine (except for an issue with null/empty which i cant figure out).

  • Default User Avatar

    Thank you so much!
    I missed that instruction. I coded the function by matching at least one value and not "exactly one" value as 1:1.
    Thanks again!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I already spent too much time trying to figure this one out so I am reaching to another pair of eyes:
    Basic test # 9 is passing these 2 arrays:
    [ 2, 2, 3 ]
    [ 4, 9, 9 ]
    My code returns true but the test fails because:
    Expected: false, instead got: true

    Can someone help?

  • Custom User Avatar

    The description says:

    If a or b are nil (or null or None), the problem doesn't make sense so return false.
    If a or b are empty the result is evident by itself.
    

    "Evident by itself" must mean "the problem doesn't make sense so return false" as well.
    Otherwise shouldn't we return true for NULL arrays?

    Please make the description clear.
    I solved correctly, it's the the description is wrong.

  • Custom User Avatar

    Why return true for empty array?
    The description says:

    If a or b are nil (or null or None), the problem doesn't make sense so return false.
    If a or b are empty the result is evident by itself.

    "Evident by itself" must mean "the problem doesn't make sense so return false" as well.
    Otherwise shouldn't we return true for NULL arrays.

    Please make the description clear.