Ad
  • Custom User Avatar

    Anyone? The random tests I'm seeing seem to be massively complex with special characters that aren't captured by the description at all.

  • Custom User Avatar

    Thank you, I think adding that will help others with focusing on the problem at hand instead of strange behavior due to unintended string multiplication.

  • Custom User Avatar

    If you take my exact solution and you remove the [int] type casting I added to the parameters of the function, then the tests fail. One of the tests passes values of:

    $a = 1; $b = 20; $c = -4; $d = -5
    

    Apparently when you pass those values in and try to perform this arithmetic:

    $n = (($a * $a) + ($b * $b)) * (($c * $c) + ($d * $d))
    

    ... to solve for the value of n it fails with this error:

    Specified argument was out of the range of valid values. Parameter name: times
    

    This is the same error you get if you crack open PowerShell and try to multiply a negative integer (represented as a string) by a negative integer (represented as a string):

    PS C:\> '-4' * '-4'
    Specified argument was out of the range of valid values.
    Parameter name: times
    At line:1 char:1
    + '-4' * '-4'
    + ~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [], ArgumentOutOfRangeException
        + FullyQualifiedErrorId : System.ArgumentOutOfRangeException
    
  • Custom User Avatar

    In PowerShell I had to cast the parameters as [int], otherwise when they were passed as negative numbers they were being treated as strings. This was a very stupid problem to have to solve.

  • Custom User Avatar

    This is with PowerShell

  • Custom User Avatar

    And how in the world is a result of PI incorrect when a string of -_P_i is provided?

  • Custom User Avatar

    How in the world is a result of )${ incorrect when a string of --)-$-{ is provided?

    I feel as though all of these various whitespace and special character scenarios that are rampant in the random tests are insufficiently covered in the description and sample cases.