摘要: ```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 一条图图犬 阅读(321) 评论(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 一条图图犬 阅读(135) 评论(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 一条图图犬 阅读(166) 评论(0) 推荐(0) 编辑