문제를 이해하고 있다면 바로 풀이를 보면 됨
전체 코드로 바로 넘어가도 됨
마음대로 번역해서 오역이 있을 수 있음
정수 rowIndex가 주어졌을 때, rowIndex(0 - indexed)번째 줄의 파스칼의 삼각형을 반환해라.
파스칼의 삼각형에서 각 숫자는 아래 보여지는 것처럼 바로 위에 있는 두 수의 합이다.

#1
Input: rowIndex = 3
Output: [1, 3, 3, 1]
#2
Input: rowIndex = 0
Output: [1]
#3
Input: rowIndex = 1
Output: [1, 1]
class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> result = new ArrayList<>();
result.add(1);
long pre = 1;
for(int i = 1; i <= rowIndex; i++){
long next = pre * (rowIndex - i + 1) / i;
result.add((int) next);
pre = next;
}
return result;
}
}