public int JumpFloor(int target) { if (target <= 2){ return target; } int pre_1 = 2; int pre_2 = 1; int nums = 0; for (int i = 3; i <= target; i++) { nums = pre_1 + pre_2; pre_2 = pre_1; pre_1 = nums; } return nums; }
public int JumpFloor(int target) { if (target <= 2){ return target; } int pre_1 = 2; int pre_2 = 1; int nums = 0; for (int i = 3; i <= target; i++) { nums = pre_1 + pre_2; pre_2 = pre_1; pre_1 = nums; } return nums; }