I’m solving the “Egyptian multiplication” community puzzle and cannot pass the final test for some reason (probably the test verification data is wrong).
The input parameters for this case (“Bigger numbers”) are:
7675 * 179
the error I get is:
Found: = 15350 * 88 + 2
Expected: = 15350 * 88 + 7
which leads to the following line of my solution:
= 15350 * 88 + 23025
When I verify with calculator I get the correct value for this line (1373825 = 7675 * 179). That’s why I think that that the test data is wrong or maybe I’m missing something in general?
I don’t understand how the egyptian multiplication works
It’s said “First, sort the two numbers.
Then follow the steps below, the algorithm uses base-2 decomposition of the biggest number.”
but in the example 12 * 5 we divide the 5 by 2
maybe if someone can give me the first line for 7675 * 179 I will be able to solve the puzzle
Another puzzle where test validators are not quite sufficient I pass all tests but get only 75%. My code doesn’t pass validator 2 but I have absolutely no way of knowing why.
Thank you for your help. My error was pretty dumb, but it did slip through test validators. It occurred only when there were steps with no “unmultiplied” integers at the end of the line, but not in test validator 2 because then my code went directly to the next odd multiplier value. In test validator 2, that occurs directly so my code didn’t skip a line like it did in real validator 2.