Concise C++ Solution


  • 0
    I
    vector<int> getRow(int rowIndex) {
        vector<int> p;
        p.resize(rowIndex+1); 
        for (int i = 0; i <= rowIndex; p[i++] = 1) 
            for (int k = i-1; k > 0; k--) 
                p[k] = p[k] + p[k-1];
        return p;
    }
    

Log in to reply
 

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