Prerequisites: Basic math
Problem: Given a number
X, the operation allowed is multiplication by 2, find the minimum number of times the operation has to be performed to make
X divisible by 10.
Explanation: The approach is quite simple and can be classified in 3 cases :
If the number is already divisible by 10, then the answer is 0.
If the number is divisible by 5, then the answer is 1. It can be proved,
N = K * 5, then if we apply the operation once, it becomes,
N = K * 5 * 2which in turn simpllifies to
N = K * 10, thus giving the desired result.
If the number doesn’t fall in previous 2 cases, then it is impossible to achieve the desired result, as for a number to be divisible by
10, it has to be divisble by