Ad
  • Custom User Avatar

    the random tests in C# were producing strings that did not conform to the specification: the matrix could have different characters (besides '*') in the same column. My guess is that nobody noticed it until now because most solvers looped from top row to bottom row and exited as soon as a non-'*' was found.

    I fixed the C# RNG, and I also added nicer assertion messages that display the input. Your code passes the random tests now. It still fails the edge cases test (empty arrays / empty strings), but that should be an easy fix.

  • Custom User Avatar

    Also the "Geometry" tag might be helpful.

  • Custom User Avatar

    Montecarlo is meant to time out. You need a more optimised solution. It doesn't hurt learning about Bayesian Statistics.

  • Custom User Avatar

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

  • Custom User Avatar

    Hi!

    Sorry I'm slow to answer, been away for a while.

    The space was originally left in there intentionally, but I forgot to remove it when I decided to only have correct test inputs. I'll fix that right away.

    An emoji test would be fun, but I'd have to adjust my current solution before I do that!

    As for your solution, I'm not quite sure where it goes wrong. The decimal for ? is 63, the trinary would be 002100. The decimal for ¤ is 164, the trinary would be 020002. I can't see why your code confuse these two. I would suggest testing the code with different inputs and see where things stop working.

  • Custom User Avatar

    Fixed, thanks for poiting this

  • Custom User Avatar

    question answered by PetitLu117

  • Custom User Avatar

    Only the other fishes from the shoal ranges from 0 to 9. You (the growing fish) are not limited in size.

  • Custom User Avatar

    I have not solved this myself so I can only speculate. I suspect that the input fish are limited to single digit ranges but that your own size can grow as large as the food eaten allows. Perhaps there is a pattern with regards to how much you eat and how big you get? Maybe we should consider ourselves a special fish that can gorow past the limits of all other fish? I realize that I am answering with more questions to a question, sorry about that.

  • Custom User Avatar

    Try switching between C# 10 and C# 12, one of these should work.

    I will take a look later why the non-working version is available, it should not.

  • Custom User Avatar

    I'm not sure how to answer this, other than to say they did.

    (edit) It's been a few months since I solved this, I see your objection now. I believe I solved this assuming all shoe sizes (per foot) were distinct. Reviewing my solution, this is not a safe assumption and adding tests with duplicated sizes may aid in weeding out false positive solutions.

  • Custom User Avatar

    Looks like sample tests expect uint as argument, but Attempt tests expect int. You should modify line 9 static void Act(uint expected, uint n) to static void Act(uint expected, int n), and you should raise this as an issue with the kata :P

  • Custom User Avatar

    Changing the return type to long is insufficient, but required. (unless you're really lucky with tests?)
    You must also cast the long to int, as some random tests expect the overflow value.

    The c# solution is currently not solvable without this realization.

  • Custom User Avatar

    Because the prefix need to be ignored, read again the last paragraph.

  • Custom User Avatar

    Hi ah2023,

    When I try your solution it passes all the tests, so I can't reproduce the issue. But in general, if you print out the customers variable at the top of your code, you should be able to see what causes any failing test.

    Regards,

    brodiemark

  • Loading more items...