Minimum Number Of Steps To Reduce N
easy
1. You are given a number N. 2. You have to find the minimum number of operations needed to reduce it to 1. 3. operations allowed are - -> If n is divisible by 2 then you may reduce n to n/2. -> If n is divisible by 3 then you may reduce n to n/3. -> Decrement n by 1.
Constraints
1 <= arr[i] <= 10^6
Format
Input
A number N
Output
Check the sample output and question video.
Example
Sample Input
10
Sample Output
3