Solution Review: Find the Egyptian Fraction
This review provides a detailed analysis of how to convert a fraction to a series of Egyptian Fractions
We'll cover the following
Solution
We can generate Egyptian Fractions using Greedy Algorithm. For a given number of the form n/d,
where d > n
, first find the greatest possible unit fraction, then perform recursion for the remaining part.
For example, consider . We first find the ceiling of , i.e., , so the first unit fraction becomes . Now subtract out of and, then recur for i.e., .
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.