“`” 参考回答:
最基础的动态规划问题
<pre><code>public class Solution {
public int JumpFloor(int target) {
if(target<=1) return target;
int[] a = new int[target+1];
a[1]=1; a[2]=2;
for(int i=3;i<=target;i++){
a[i] = a[i-1] + a[i-2];
}
return a[target];
}
}
</code></pre>
<pre><code> "“`
Was this helpful?
0 /
0