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.
This comment is hidden because it contains spoiler information about the solution
This happens only if arr contains 1 element. In that case you should just return 0 at the beginning of the program.
Re-checked and re-published twice to make sure :)
When I press "Run Examples" for C#, I still see following:
error CS0117:
Tree.TreeNode' does not contain a definition for
MaxSum'Please check
Edit: deleted the previous example as I probably made a copy/paste mistake. Turned out I was failing on the exact same array as chris_w, so I guess
RandomTests
aren't that random.Edit2: I just managed to pass this kata by just taking the middle value as median and no longer accounting for even length arrays, so the problem is that they're still part of the test suite.
Could you please elabore, Ivsz? The spec requires the data set to be of an odd length. However, even though I've fixed the tests (they now only generate data sets of odd length as required by the spec), I did implement even-length data set support and tested it. Do you still have illegal tests generated for you? Thank you.
Do you have to wait for the changes to take effect? I'm still experiencing the same problem, even though I also get
mean: -1.242775, median: -3.000000, largest = mean
using the above array as input.I've located the bug and fixed it. Thank you for your contribution, Chris!
If you are interested in the nature of the bug causing the issue:
Kata spec requires the data set cardinality (length) to be an odd number. In my tests, however, I failed to convert the randomly generated data set size to an odd value. Thus, the solution function, which was not built to accommodate even values, had a data set of even cardinality passed to it, thus causing problems.
Hey, Chris, thanks for reporting the issue! I'm looking into it.
Indeed. fixed!
I'll edit, solved a few and didn't notice.
By the way, is there a way for you to enforce it?
If you "unlock solutions" for a kata in another language you can then create a translation in the desired language without having to solve it.
Excellent. Thanks. Kind of an odd problem, especially with it hidden away like that.
I tried the C# version of this, and I'm repeatedly getting an exception thrown with every one of the calls saying that the key is not found. I copied my code into Visual Studio with the dictionary being a private variable in my test class, and it ran perfectly.
I have a feeling there's a disconnect and that dictionary needs to be made static on a class so we're able to access it from our test code.
Thanks !
Loading more items...