标签:style blog color io ar for div sp log
1 public class Solution { 2 public List<Integer> getRow(int rowIndex) { 3 List<Integer> result = new ArrayList<Integer>(); 4 for (int i=0; i<=rowIndex; i++) { 5 for (int j=i; j>=0; j--) { 6 if (j==i) result.add(1); 7 else if (j>0) result.set(j, result.get(j) + result.get(j-1)); 8 } 9 } 10 return result; 11 } 12 }
[LeetCode] Pascal's Triangle II
标签:style blog color io ar for div sp log
原文地址:http://www.cnblogs.com/yuhaos/p/3965060.html