class Solution { public: vector getRow(int rowIndex) { vector result; result.push_back(1); for (auto k = 0; k < rowIndex; k++) { auto next = static_cast( static_cast(result.back()) * (rowIndex - k) / (k + 1)); result.push_back(next); } return result; } };