A workshop cuts square tiles of every integer side (1x1, 2x2, 3x3, ...). A customer wants tiles whose areas add up to exactly area. Return the smallest number of tiles that works. (An answer always exists because 1x1 tiles can fill anything.)
Examples
Input: area = 18
Output: 2
Explanation: 9 + 9.
Input: area = 21
Output: 3
Explanation: 16 + 4 + 1; no two squares sum to 21.
Constraints
1 <= area <= 5000- Target complexity: O(area * sqrt(area)) time.
Goals
- Write a min-count recurrence over all square summands
- Bound the inner loop by the square root of the target