plz answer the above question correctly...
Attachments:

Niharika1415:
plz write the program given in the question
Answers
Answered by
1
// Returns count of minimum squares that sum to nint getMinSquares(unsigned int n){ // base cases if (n <= 3) return n; // getMinSquares rest of the table using recursive // formula int res = n; // Maximum squares required is n (1*1 + 1*1 + ..) // Go through all smaller numbers // to recursively find minimum for (int x = 1; x <= n; x++) { int temp = x*x; if (temp > n) break; else res = min(res, 1+getMinSquares(n - temp)); } return res;}
Similar questions
Computer Science,
9 months ago
Social Sciences,
1 year ago
Math,
1 year ago
India Languages,
1 year ago