Ad
  • Default User Avatar

    Yes it can happen than one factor is zero (or both...). Non-negative meaning ">=0". I tried your solution and the problem comes when an element is zero because in this case the condition "P = A ** 2 + B ** 2" is not satisfied by your return. It is possible that you have an issue when seeing if a big integer is a perfect square or not.
    Allow me to add that your code doesn't follow the right way to find an answer in all cases. Cheers and good luck.

  • Default User Avatar

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

  • Default User Avatar

    But if the sum is a perfect square itself doesnt that makes finding two factor for it redundant.
    and also in sample test setter himself has given us an example in which one factor is 0.

  • Custom User Avatar

    The tests fail when one of returned numbers is 0, while description says the answer needs to be non-negative.

    As a temporary workaround you can try to return such pair, where none of the numbers is 0. For example, tests fail for:

    Input: [3, 2, 5, 5, 4, 2, 6, 6, 9, 3, 3, 2, 3, 7, 2, 3, 4, 9, 6, 7, 3, 8, 8, 7, 6, 3, 6, 6, 4, 4, 5, 3, 9, 8, 3, 9, 2, 2, 6, 6]
    Output: [38575890503412110, 0]
    
  • Custom User Avatar

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

  • Default User Avatar

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