0ms C++ solution


  • 1
    vector<int> getRow(int k) {
        vector<int>answer(k+1,0);
        
        for(int i=0;i<=k;i++){
            answer[k]=1;
            for(int j=k-1;j>0;j--){
                answer[j] += answer[j-1];
            }
            answer[0]=1;
        }
        return answer;
    }

Log in to reply
 

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