Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Number Theory but also build up problem-solving skills.
You are given a string str containing two fractions a/b and c/d, compare them and return the greater. If they are equal, then return "equal".
Note: The string str contains "a/b, c/d"(fractions are separated by comma(,) & space( )).
Examples
Input: str = "5/6, 11/45"
Output: 5/6
Explanation: 5/6=0.8333 and 11/45=0.2444, So 5/6 is greater fraction.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/compare-two-fractions4438/1