Search
 
SCRIPT & CODE EXAMPLE
 

PASCAL

print pascal triangle

vector<vector<int>> generate(int numRows) {
    vector<vector<int>> ans;
    vector<int> first(1,1);
    ans.push_back(first);
    int n = numRows;
    for(int i=1; i<n; i++){
        vector<int> second(i+1,0);
        for(int j=0; j<i+1; j++){
            if(j==0 || j==i) second[j] = 1;
            else{
                second[j] = first[j] + first[j-1];
            }
        }
        ans.push_back(second);
        first = second;
    }
    return ans;
}
Comment

PREVIOUS NEXT
Code Example
Pascal :: Pascal (fpc 3.0.4) sample 
Pascal :: pascal const 
Powershell :: powershell display firewall rules name 
Powershell :: powershell -executionpolicy bypass -file 
Powershell :: How to test HDD health in PowerShell 
Gdscript :: godot close game 
Gdscript :: godot make string all lowercase 
Clojure :: clojure read file line by line 
Abap :: abap integer 
Lisp :: common lisp map number to word 
Assembly :: openssl public key der to pem 
Assembly :: javafx observable collection 
Assembly :: that long word from mary poppins 
Assembly :: io mapped io and memory mapped io in 8085 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: js on page ready 
Javascript :: open ilnk target js 
Javascript :: refresh window js 
Javascript :: jquery accept only excel file 
Javascript :: check if a variable is undefined jquery 
Javascript :: media query js 
Javascript :: change input placeholder text jquery 
Javascript :: get current url js 
Javascript :: convert to objectid mongoose 
Javascript :: javascript async delay 
Javascript :: javascript refresh page every 30 seconds 
Javascript :: how to change a css variable with javascript 
Javascript :: hide header react navigation 
Javascript :: listing dir by nodejs 
Javascript :: javascript celcius to farenheit 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =