InterviewBit - Kth Row of Pascal Triangle
by ne on 2021-09-29 under Algo/DS/Problems tagged with interviewbit
This problem is a property of InterviewBit (www.interviewbit.com).
Full details of the question, and if you want to try it out yourself, proceed to interviewbit : https://www.interviewbit.com/problems/kth-row-of-pascals-triangle/
Here's the implementation:
public class Solution {
public int[] getRow(int A) {
int[][] arr=new int[A+1][];
arr[0]=new int[1];
arr[0][0]=1;
for(int i=1;ij)
arr[i][j]=arr[i-1][j-1]+arr[i-1][j];
else
arr[i][j]=1;
}
}
return arr[A];
}
}