上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页
摘要: ```C++ class Solution { public: vector matrixReshape(vector & nums, int r, int c) { if(nums.empty() || nums[0].empty()){ return {}; } auto h = nums.si 阅读全文
posted @ 2018-08-04 22:05 一条图图犬 阅读(262) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: vector generate(int numRows) { vector res; if(numRows curr_row; int r=1; while(r 阅读全文
posted @ 2018-08-04 16:56 一条图图犬 阅读(341) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: vector transpose(vector & A) { vector res; if(A.empty() || A[0].empty()){ return res; } int h = A.size(); int w = A[0] 阅读全文
posted @ 2018-08-04 16:35 一条图图犬 阅读(439) 评论(0) 推荐(0) 编辑
摘要: ```python3 class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 if len(nums) == 1: ... 阅读全文
posted @ 2018-08-04 11:57 一条图图犬 阅读(382) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; ... 阅读全文
posted @ 2018-08-04 11:33 一条图图犬 阅读(229) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int climbStairs(int n) { int a = 1; int b = 1; int temp; while(n>0){ n--; temp = a; a = b; ... 阅读全文
posted @ 2018-08-03 11:57 一条图图犬 阅读(227) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int rob(vector& nums) { if( nums.empty()){ return 0; } if( nums.size() == 1){ return nums[0]; } vect... 阅读全文
posted @ 2018-08-02 17:52 一条图图犬 阅读(465) 评论(0) 推荐(0) 编辑
摘要: ```python3 class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ curr = nums[0] res = nums[0] # 当前子序列和只有在cu... 阅读全文
posted @ 2018-08-02 17:34 一条图图犬 阅读(320) 评论(0) 推荐(0) 编辑
摘要: ```C++ #include class Solution { public: int maxSubArray(vector& nums) { int curr = 0; int res = INT_MIN; for(int i=0; i curr? res: curr; } return res; ... 阅读全文
posted @ 2018-08-02 17:18 一条图图犬 阅读(133) 评论(0) 推荐(0) 编辑
摘要: ```python3 def climbStairs(self, n): """ :type n: int :rtype: int """ a = 1 b = 1 for i in range(n): a, b = b, a + b return a ``` 阅读全文
posted @ 2018-08-02 16:57 一条图图犬 阅读(165) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页