摘要: ```python3 class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ d = {} for i in... 阅读全文
posted @ 2018-08-04 23:46 一条图图犬 阅读(147) 评论(0) 推荐(0) 编辑
摘要: ```python3 class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ res = 0 curr = 0 for i in nums... 阅读全文
posted @ 2018-08-04 23:29 一条图图犬 阅读(248) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: vector getRow(int rowIndex) { rowIndex++; if(rowIndex res(rowIndex, 0); res[0] = 1; vector curr = res; for(int i=1;i 阅读全文
posted @ 2018-08-04 23:24 一条图图犬 阅读(287) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: void moveZeroes(vector& nums) { if(nums.empty() || nums.size() == 1){ return; } auto slow = nums.begin(); auto fast = 阅读全文
posted @ 2018-08-04 22:55 一条图图犬 阅读(103) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int rec(vector & grid, int i, int j){ if(i =grid.size() || j = grid[0].size()){ return 0; } if(grid[i][j] == 1){ grid[ 阅读全文
posted @ 2018-08-04 22:34 一条图图犬 阅读(699) 评论(0) 推荐(0) 编辑
摘要: ```python3 class Solution: def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ freq = {} for i in nums: if i not ... 阅读全文
posted @ 2018-08-04 22:13 一条图图犬 阅读(330) 评论(0) 推荐(0) 编辑
摘要: ```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) 编辑