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.
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.
Also the "Geometry" tag might be helpful.
Montecarlo is meant to time out. You need a more optimised solution. It doesn't hurt learning about Bayesian Statistics.
This comment is hidden because it contains spoiler information about the solution
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.
Fixed, thanks for poiting this
question answered by PetitLu117
Only the other fishes from the shoal ranges from 0 to 9. You (the growing fish) are not limited in size.
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.
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.
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.
Looks like sample tests expect
uint
as argument, but Attempt tests expectint
. You should modify line 9static void Act(uint expected, uint n)
tostatic void Act(uint expected, int n)
, and you should raise this as an issue with the kata :PChanging 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.
Because the prefix need to be ignored, read again the last paragraph.
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...