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.
Anyone? The random tests I'm seeing seem to be massively complex with special characters that aren't captured by the description at all.
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.
There are not many PS people at CW so let us be kind:
I modified the signature from:
to
.
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:Apparently when you pass those values in and try to perform this arithmetic:
... to solve for the value of
n
it fails with this error: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):
Who treated them as strings? Negative numbers are [int] and they were passed as negative numbers; frankly I don't understand your problem.
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.This is with PowerShell
You should mention the language you're having that problem. Those inputs seem weird.
Read the error message, it tells you exactly with which input your code is failing and it's not possible your code works with that input.
And how in the world is a result of
PI
incorrect when a string of-_P_i
is provided?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.