您的位置:首页 > 其它

Pascal's Triangle II

2015-07-01 20:07 309 查看
public class Solution {
public List<Integer> getRow(int rowIndex) {
List<Integer> result = new ArrayList<Integer>();
if (rowIndex < 0) {
return result;
}
result.add(1);
for (int i = 0; i < rowIndex; i++) {
result.add(1);
for (int j = i; j > 0; j--) {
result.set(j, result.get(j) + result.get(j - 1));
}
}
return result;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Math