import java.util.*;

public class Solution {
    public int[][] generate (int num) {
        // write code here
        int[][] arr = new int[num][];
        int i,j;
         
        for(i=0;i<num;i++){
            arr[i] = new int[i+1];
            if(i==0)arr[0][0]=1;
            else {
                for(j=0;j<=i;j++){
                    int t1 = j-1<0?0:arr[i-1][j-1];
                    int t2 = j == i?0:arr[i-1][j];
                    arr[i][j]=t2+t1;
                }
            }
        }
        return arr;
    }
}