My c++ solution


  • 0
    X

    class Solution {
    public:
    vector<int> getRow(int rowIndex) {
    vector<int> r(rowIndex+1);
    r[0]=r[rowIndex]=1;
    for(int i=1;i<rowIndex;i++)
    {
    r[i]=(long)r[i-1]*(rowIndex-i+1)/i;
    }
    return r;
    }
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.