Niu Ke (11) Rectangular Cover

// topic description
// We can use 2*1 small rectangles to cover larger rectangles horizontally or vertically.
// How many ways are there to cover a large 2*n rectangle with n small 2*1 rectangles without overlapping?
    public static int RectCover(int target) {
        if (target<1){
            return 0;
        }
        if (target==1){
            return 1;
        }
        if (target == 2){
            return 2;
        }
        return RectCover(target-1)+RectCover(target-2);
    }

  

Guess you like

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