Problem 2126. Split bread like the Pharaohs - Egyptian fractions and greedy algorithm
Solution Stats
Problem Comments
-
3 Comments
Try to use "unique(floor(..." in the test cases. Isn't it Alfonso?? ;-)
This problem is quite well constructed and described. However, per the WP article linked to, it is important to specify two additional requirements: 〔1〕 Denominators must be positive. This is not explicitly mentioned in the Problem Statement [although perhaps it's implied], and moreover it's not checked in the Test Suite. That means 3/4 = 1/(1) + 1/(-4) would be erroneously accepted. 〔2〕 Each of the denominators must be different/unique. That is enforced in the Test Suite, but there's no mention of it in the Problem Statement. —DIV
Can't submit a solution to this problem (temporary unavailability of MATLAB Service).
Solution Comments
-
3 Comments
Sorry this is not the solution. Output is not an integer
Time to update the test suite again...
I'm always happy to have a learning opportunity
-
2 Comments
While this meets the letter of the problem requirements, it clearly violates the spirit. I recommend using "unique(denom = egyptian_fraction(Vmin,Vmax));" to prevent this.
Interesting observation.
-
1 Comment
Please resubmit your solution; previous test suite was buggy.
Problem Recent Solvers60
Suggested Problems
-
7606 Solvers
-
193 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
825 Solvers
-
407 Solvers
-
Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
456 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!