Minimize the Number of Perfect Squares Summing to an Integer
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
### Problem
Return the fewest positive perfect-square summands whose sum is n. Reusing the same square is allowed.
```cpp
int numSquares(int n);
```
### Examples
```text
n = 18 -> 2
n = 1 -> 1
```
### Constraints
- 1 <= n <= 10000.
Overview: Minimize the Number of Perfect Squares Summing to an Integer. Return the fewest positive perfect-square summands whose sum is n. Reusing the same square is allowed.