# LeetCode 279 - Perfect Squares

LeetCode 279 - Perfect Squares

## 思路

f(0) = 0
f(1) = 1(1)
f(2) = 2(1 + 1) = 1 + f(2 - 1)
f(3) = 3(1 + 1 + 1) = 1 + f(3 - 1)
f(4) = 1(4) = f(4) + f(0)
f(5) = 2(4 + 1) = 1 + min(f(5 - 1), f(5 - 4))
f(6) = 3(4 + 1 + 1) = 1 + min(f(6 - 1), f(6 - 4))
f(7) = 4(4 + 1 + 1 + 1) = 1 + min(f(7 - 1), f(7 - 4))
f(8) = 3(4 + 4) = 1 + min(f(8 - 1), f(8 - 4))
f(9) = 1(9) = 1 + min(f(9 - 1), f(9 - 4), f(9 - 9))

base case：f(0) = 0, f(1) = 1