摘要:
```python3
class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ d = {} for i in... 阅读全文
摘要:
```python3 class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ res = 0 curr = 0 for i in nums... 阅读全文
摘要:
```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 阅读全文
摘要:
```C++ class Solution { public: void moveZeroes(vector& nums) { if(nums.empty() || nums.size() == 1){ return; } auto slow = nums.begin(); auto fast = 阅读全文
摘要:
```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[ 阅读全文
摘要:
```python3
class Solution: def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ freq = {} for i in nums: if i not ... 阅读全文
摘要:
```C++ class Solution { public: vector matrixReshape(vector & nums, int r, int c) { if(nums.empty() || nums[0].empty()){ return {}; } auto h = nums.si 阅读全文
摘要:
```C++ class Solution { public: vector generate(int numRows) { vector res; if(numRows curr_row; int r=1; while(r 阅读全文
摘要:
```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] 阅读全文
摘要:
```python3 class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 if len(nums) == 1: ... 阅读全文
摘要:
```C++
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; ... 阅读全文