Given a number n, count the minimum number of steps needed to reduce the number to 1.
You can perform one of the following operations:-
1. if n is even, we can reduce it to n/2
2. if n is divisible by 3, we can reduce it to n/3
3. otherwise, decrement 1.
return minimum number of operations needed to convert n to 1.
Thanks in advance.