Given an integer n, return the fewest number of perfect squares that sum to n.
n
n = 12
3
Why
12 = 4 + 4 + 4
n = 13
2
13 = 4 + 9
1 <= n <= 10^4
Topics
Implement numSquares in the editor and return the answer — printing it is never graded.
numSquares
Problem 96 of 1146 in the arena