2022-07-19 16:48:05 +02:00
|
|
|
class Solution {
|
2024-01-03 12:06:42 +01:00
|
|
|
public:
|
|
|
|
vector<int> getRow(int rowIndex) {
|
2022-07-19 16:48:05 +02:00
|
|
|
vector<int> result;
|
|
|
|
|
|
|
|
result.push_back(1);
|
|
|
|
for (auto k = 0; k < rowIndex; k++) {
|
2024-01-03 12:06:42 +01:00
|
|
|
auto next = static_cast<int>(static_cast<long>(result.back()) *
|
|
|
|
(rowIndex - k) / (k + 1));
|
2022-07-19 16:48:05 +02:00
|
|
|
result.push_back(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|