I want to know why my program is Runtime error ? Could anybody help me, thanks!


  • 0
    H

    class Solution {
    public:
    vector<int> nextPasc(vector<int> s){
    vector<int> ss;
    int len=s.size()+1;
    for(int i=0;i<len;i++){
    if(i==0||i==len-1)
    ss.push_back(1);
    else{
    ss.push_back(s[i-1]+s[i]);
    }
    }
    return ss;
    }
    vector<vector<int> > generate(int numRows) {
    if(numRows==0) return vector<vector<int>>(0);
    vector<vector<int> > s(numRows);
    int i=1;
    s[0].push_back(1);
    while(i<numRows){
    s[i].assign(nextPasc(s[i-1]).begin(),nextPasc(s[i-1]).end());
    i++;
    }
    return s;
    }
    };


Log in to reply
 

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