1 Star 0 Fork 0

表情扭曲 / leetcode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lc119.java 627 Bytes
一键复制 编辑 原始数据 按行查看 历史
liu13 提交于 2019-03-14 14:54 . 0314
package code;
import java.util.ArrayList;
import java.util.List;
/*
* 119. Pascal's Triangle II
* 题意:和118一样,就是输出不一样
* 难度:Easy
* 分类:Array
* 思路:记一下 ArrayList.set 方法,不用重新 new ArrayList
* Tips:
*/
public class lc119 {
public List<Integer> getRow(int rowIndex) {
ArrayList<Integer> res = new ArrayList<>();
res.add(0,1);
while(rowIndex-->0){
res.add(0,1);
for (int i = 1; i < res.size()-1 ; i++) {
res.set(i, res.get(i)+res.get(i+1));
}
}
return res;
}
}
1
https://gitee.com/abfantasy/leetcode.git
git@gitee.com:abfantasy/leetcode.git
abfantasy
leetcode
leetcode
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891