How to calculate GCD/HCF with optimization.
Step 1 : Calculate Remainder between A and B.
Step 2 : Change A with B and B with remainder obtained
Step 3 : Do this recursively till we get B as 0
Note : A > B, if its not the case then change B and A.
To count the digits in a factorial we must seek some optimization as you might also understand that getting all the product and storing the...
No comments:
Post a Comment