Optimized solution to find LCM
We can use the formula :
A * B = GCD(A,B) * LCM(A,B)
(simple pair hai ye....)
As,
LCM(A,B) = (A*B) / GCD(A,B)
What is GCD?
=> Here
Code :
Optimized solution to find LCM
We can use the formula :
A * B = GCD(A,B) * LCM(A,B)
(simple pair hai ye....)
As,
LCM(A,B) = (A*B) / GCD(A,B)
What is GCD?
=> Here
Code :
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