Hi I went ahead and tried to translate this Kata into Rust. I'd apprecate any feedback.
You can add the image to that kata instead ;-)
No, 5.666666666666667 is correct because you can also cut the length 17 rod into 3 pieces.
I cannot commit my solution.
One of the tests is:
Test.assert_equals(maxlen(5, 17), 5.666666666666667)
The solution is 5 and not 5.666666666666667. The shortest stick cannot grow to 5.666666.
The test should be
Test.assert_equals(maxlen(5, 17), 5)
It is kinda weird. The same comment was already given 10-11 months ago and is marked as solved. ???
Santa Claus changed it back to 5.666666666666667 ?
True... too bad, I found such a nice image ;-)
Description updated with image + explanation to make it more clear.
Each face of the tetrahedron is a triangle with the side of the N balls. I have a picture, but I can't add it to the condition of the problem
I guess the author should add a little more detail in the problem statement. I didn't fully understand what was required, especially the "edge consists of N balls" part. Or maybe I am bad at maths. :-)
I feel that the description could be worded better to make it more clear what the goal is.
Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can throw away leftover pieces.
Write a function, maxlen, that takes the lengths of the two sticks (L1 and L2, both positive values), that will return the maximum length you can make the three sticks.
May be "Your must get (or receive ?) three equal sticks maximal length." instead "Your must cut them on three equal sticks maximal length."?
17/3=5.66 > 5
Test bug confirmed.
In the case of 5 17 shows the valid answer is 5.66, what is completely wrong - you can't chop 5 to 5.66.
Bugs @ test cases :). improve 'em .
This comment is hidden because it contains spoiler information about the solution