Pascal's triangle: Difference between revisions

→‎Summing from Previous Rows: initial "last" is never used
(→‎Summing from Previous Rows: now it will work for rows = 0)
(→‎Summing from Previous Rows: initial "last" is never used)
Line 341:
if(rows < 0) return;
//save the last row here
LinkedList<Integer> last= new= LinkedList<Integer>()null;
last.add(1);//it's row 0...it starts with 1
for(int i= 0;i <= rows;++i){
//work on the next row
Anonymous user