You are viewing a single comment's thread. Return to all comments →
int memo[10000005]; int rec(int n){ if(n==0) return 0; if(memo[n]==0){ int min=rec(n-1)+1; for(int i=2;i*i<=n;i++){ if(n%i==0){ if((rec(n/i)+1)<min) min=rec(n/i)+1; } } memo[n] = min; return memo[n]; }
the top bottom is easier to understand, this is basically what he did, just that mine didnt get accepted :/
Down to Zero II
You are viewing a single comment's thread. Return to all comments →
the top bottom is easier to understand, this is basically what he did, just that mine didnt get accepted :/