- 👋 Hi, I’m @AmarRich
- 👀 I’m interested in ...
- 🌱 I’m currently learning ...
- 💞️ I’m looking to collaborate on ...
- 📫 How to reach me ...
class Solution { public: int numSquares(int n) { vector dp(n+1); dp[0]=0,dp[1]=1; for (int i=2;i<=n;i++){ int m=INT_MAX; for(int j=1;jj<=i;j++){ int rem=i-jj; m=min(m,dp[rem]); } dp[i]=m+1;// +1 previous } return dp[n]; } };