problem on dynamic programming

Правка en1, от daiict, 2016-07-02 10:17:23

Can anyone help me on the following problem of dynamic programming.Problem statement is as follows: Given a number n find the least number of perfect square numbers sum needed to get n. E.g.

n = 12, return 3 (4 + 4 + 4) = (2^2 + 2^2 + 2^2) NOT (3^2 + 1 + 1 + 1)

n =6, return 3(4 + 1 + 1) = (2^2 + 1^2 + 1^2)

Теги dynamic programming

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский daiict 2016-07-02 10:17:23 345 Initial revision (published)