题解 | #跳台阶扩展问题#
两个链表的第一个公共结点
http://www.nowcoder.com/practice/6ab1d9a29e88450685099d45c9e31e46
固定起点和终点,中间只有target-1个台阶选择跳到或没跳到,就是2的target-1的次方。(有点像高中的排列组合问题
public class Solution { public int jumpFloorII(int target) { if(target<3){ return target; } //固定起点和终点,中间只有target-1个台阶选择跳到或没跳到,就是2的target-1的次方 return (int)Math.pow(2,target-1); } }