Ad
  • Custom User Avatar

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

  • Default User Avatar

    This happens only if arr contains 1 element. In that case you should just return 0 at the beginning of the program.

  • Default User Avatar

    Re-checked and re-published twice to make sure :)

  • Default User Avatar

    When I press "Run Examples" for C#, I still see following:
    error CS0117: Tree.TreeNode' does not contain a definition for MaxSum'
    Please check

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    Hey, Chris, thanks for reporting the issue! I'm looking into it.

  • Default User Avatar

    Indeed. fixed!

  • Default User Avatar

    I'll edit, solved a few and didn't notice.

    By the way, is there a way for you to enforce it?

  • Custom User Avatar

    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.

  • Default User Avatar

    Excellent. Thanks. Kind of an odd problem, especially with it hidden away like that.

  • Default User Avatar

    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.

  • Custom User Avatar
  • Loading more items...