2015年8月23日

【剑指offer】一,跳台阶(java实现)

摘要: 题目描述一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法。分析:此题为典型的递归问题,递归问题的典型解法就是找到递推公式和边界条件。青蛙跳上第N阶前可能在第N-1,N-2 阶得到递推公式f(n)=f(n-1)+f(n-2)。考虑边界条件当n为1时,有1种方法。... 阅读全文

posted @ 2015-08-23 22:35 小猿之路 阅读(540) 评论(0) 推荐(0)

2015年8月14日

【leetcode】TrappingRainWater

摘要: 原题为:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after rainin... 阅读全文

posted @ 2015-08-14 17:18 小猿之路 阅读(124) 评论(0) 推荐(0)

导航