mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
13 lines
295 B
C
13 lines
295 B
C
|
class Solution {
|
||
|
public:
|
||
|
vector<int> getRow(int rowIndex) {
|
||
|
vector<int> v(rowIndex + 1, 0);
|
||
|
v[0] = 1;
|
||
|
for (int i = 0; i < rowIndex; i++){
|
||
|
for(int j = i + 1; j > 0; j--){
|
||
|
v[j] += v[j - 1];
|
||
|
}
|
||
|
}
|
||
|
return v;
|
||
|
}
|
||
|
};
|