You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 思路分析:考察DP,定义ClimbWays数组,ClimbWays[n]表示n steps不同的走法,如果第n步是一个单步,这种情况的走法有ClimbWays[n-1]…

2014年11月29日 0条评论 1点热度 阅读全文

LeetCode Maximum Subarray  Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] has the largest sum …

2014年10月30日 0条评论 3点热度 阅读全文