func getRow(rowIndex int) []int {
res := make([]int, rowIndex + 1)
res[0] = 1
for i := 1; i < rowIndex+1; i++ {
res[i] = res[i-1] * (rowIndex-i+1) / i
}
return res
}
class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> ans = new ArrayList<>();
ans.add(1);
long curElement = 1;
for (int i = 1; i <= rowIndex; i++) {
curElement = curElement * (rowIndex-i+1) / i;
ans.add((int)curElement);
}
return ans;
}
}