Lintcode Perfect Squares

 

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

 

可以参照大神的笔记

posted on 2016-08-06 23:35  猛犸猴子  阅读(99)  评论(0)    收藏  举报

导航