The sword refers to Offer_Programming questions_9

Topic description

A frog can jump up 1 steps at a time, it can jump up 2 steps...it can also jump up n steps. Find how many ways the frog can jump up a n-level stair.
class Solution {
public:
    int jumpFloorII(int number) {
        int key = 1;
        int i;
        for( i = 0; i < number-1; i++) {
            key = key * 2;
        }
        return key;
    }
};

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324648898&siteId=291194637