摘要: 该题来自leetcode,原题如下:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only cons... 阅读全文
posted @ 2015-10-18 20:04 lasclocker 阅读(948) 评论(0) 推荐(0) 编辑
摘要: 斐波那契数列:1, 1, 2, 3, 5, 8, 13,...,即 f(n) = f(n-1) + f(n-2). 求第n个数的值。方法一:迭代 public static int iterativeFibonacci(int n) { //简单迭代 int a = 1, b =... 阅读全文
posted @ 2015-10-18 14:26 lasclocker 阅读(540) 评论(0) 推荐(0) 编辑