PROBLEM LINK:Author: Shikhar Kunal DIFFICULTY:EASY. PREREQUISITES:Math, Factorial PROBLEM:Given two strings representing repeated factorials of two input numbers. Compare them. EXPLANATION:It is not always possible to calculate the value by applying the factorial operation as the value will be very large. But the logic for this problem can be inferred from the constraints given in the problem. The integer part will always contain a value less than 10^9. The first number to have its factorial in the order of 10^9 is 12. So for all numbers less than or equal to 12, we expand one factorial sign and replace the no with the expanded number. We keep on doing this until the expanded number can overshoot 10^9. So, we keep on expanding only the numbers less than or equal to 12. We can choose to expand upto any number say 15, provided its factorial can be stored in a data type. AUTHOR'S SOLUTIONS:Author's solution can be found here.
This question is marked "community wiki".
asked 23 Feb '18, 18:55
