Lintcode Perfect Squares

时间:2022-12-12 13:36:30

Given a positive integer n, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum to n.

Given n = 12, return 3 because 12 = 4 + 4 + 4
Given n = 13, return 2 because 13 = 4 + 9

刷这道题目发现网上有四种解法

http://www.cnblogs.com/grandyang/p/4800552.html

可以参照大神的笔记