标签:
题目描述:public class Solution { public IList<int> GetRow(int rowIndex) { if(rowIndex == 0){ return new List<int>(){1}; } if(rowIndex == 1){ return new List<int>(){1,1}; } var list = new List<int>(){1,1}; for(var i = 1;i < rowIndex; i++){ var r = new List<int>(); r.Add(1); for(var j = 0;j < list.Count - 1; j++){ r.Add(list[j] + list[j+1]); } r.Add(1); list = r; } return list; } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
LeetCode -- Pascal's Triangle II
标签:
原文地址:http://blog.csdn.net/lan_liang/article/details/49531099