博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[LeetCode]Pascal Triangle II
阅读量:4149 次
发布时间:2019-05-25

本文共 442 字,大约阅读时间需要 1 分钟。

class Solution {public:	vector
getRow(int rowIndex) { // Start typing your C/C++ solution below // DO NOT write int main() function vector
ans(rowIndex+2, 0); vector
tmp(rowIndex+2, 0); ans[1] = 1;//first row for(int i = 1; i <= rowIndex; ++i) { tmp = ans; for(int j = 1; j <= i+1; ++j) ans[j] = tmp[j-1]+tmp[j]; } ans.erase(ans.begin());//delete prefix zero return ans; }};

转载地址:http://nmxti.baihongyu.com/

你可能感兴趣的文章
google的guava工具类splitter和apache stringutil对比
查看>>
关注google的guava工具包Map集合
查看>>
guava 15新特性介绍
查看>>
google guava的splitter用法
查看>>
Guava API学习之Optional 判断对象是否为null
查看>>
Guava API学习之Ordering犀利的比较器
查看>>
Guava API学习之Preconditions优雅的检验参数
查看>>
Guava Collections API学习之Multimap
查看>>
Guava Collections API学习之Iterators
查看>>
Guava Collections API学习之Lists
查看>>
Guava Collections API学习之ArrayListMultimap
查看>>
Guava Collections API学习之AbstractMapBasedMultimap
查看>>
Guava Collections API学习之HashBiMap
查看>>
Guava Collections API学习之Bimap
查看>>
Guava Collections API学习之Multisets
查看>>
Guava API学习之Resources
查看>>
Guava API学习之CharSequenceReader
查看>>
Guava API学习之Range
查看>>
Guava API学习之RangeSet
查看>>
Guaval API学习之RangeMap
查看>>