Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ** generate(int A, int *number_of_rows) {
- // SAMPLE CODE
- *number_of_rows = A;
- int **res = (int **)malloc(A * sizeof(int *));
- // DO STUFF HERE
- int i; int j;
- for(i=0;i<*number_of_rows;i++){
- res[i] = (int *)malloc((i+1)*sizeof(int));
- for(j=0;j<=i;j++){
- if(j==0 || i==j){
- res[i][j]=1;
- }
- else{
- res[i][j]= res[i-1][j]+res[i-1][j-1];
- }
- }
- }
- return res;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement