Medium
,DP
,Math
Given an integer n
, return the least number of perfect square numbers that sum to n
.
A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 1
, 4
, 9
, and 16
are perfect squares while 3
and 11
are not.
解法一
根據四平方和定理,每一個正整數均可以表示為4個整數的平方和。
Marsgoat Nov 22, 2022
解法二
跟大家學的DP
Marsgoat Nov 23, 2022
很慢的DP
DT Nov 22, 2022
依舊很慢的 DP
gpwork4u Nov 22, 2022
也很慢的DP
XD Nov 22, 2022