qingcheng奕 |
|
||
2013年11月15日
摘要:
http://oj.leetcode.com/problems/pascals-triangle-ii/杨辉三角2,比杨辉三角要求的空间上限制Could you optimize your algorithm to use onlyO(k) extra space?其实计算当前行,也只用到前一行了。再前面的没有用。class Solution {public: vector getRow(int rowIndex) { // IMPORTANT: Please reset any member data you declared, as // the same... 阅读全文
摘要:
http://oj.leetcode.com/problems/pascals-triangle/杨辉三角先分析数据,找出规律ans[row][col] = ans[row-1][col-1]+ans[row-1][col]#include #include #include using namespace std;class Solution {public: vector > generate(int numRows) { // IMPORTANT: Please reset any member data you declared, as // the ... 阅读全文
|
Copyright © 2024 qingcheng奕
Powered by .NET 8.0 on Kubernetes |