For this Question: Given an integer N, in one operation you can subtract any odd divisor from the number other than the number itself. You have to find the minimum number of operation needed to convert the number to 1.The input contains a single integer N.

Constraints:-
1 <= N <= 10000Print the minimum number of operations needed to convert the given number to 1.Sample Input:-
10

Sample Output:-
5

Explanation:-
10- >5- >4- >3- >2- >1

Sample Input:-
20

Sample Output:-
7, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

int dp[100005];
int solve(int n){
//cout<<n<<" ";
if(dp[n]==-1){
    int x=INT_MAX;
    int y = sqrt(n);

    for(int i=1;i<=y;i++){
        if(n%i==0){
            if(i&1){
                x=min(solve(n-i),x);
            }
            if(((n/i)&1) && i>1){

                x=min(solve(n-n/i),x);
            }
        }
    }
    dp[n]=x+1;


}
return dp[n];
}
int main(){
for(int i=0;i<10005;i++){
    dp[i]=-1;
}
int n;
cin>>n;
dp[1]=0;
dp[2]=1;
cout<<solve(n)<<endl;
    }


, In this Programming Language: C++, Now tell me if this Code is compilable or not?