摘要:
```python3
class Solution: def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ d = {} fo... 阅读全文
摘要:
```C++ class Solution { public: vector findDisappearedNumbers(vector& nums) { vector res; int m; for(int i=0;i 0){ nums[m] *= -1; } } ... 阅读全文
摘要:
```python3
class Solution: def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ s = set() for i in nums: if i i... 阅读全文
摘要:
class Solution { public: int maxProfit(vector& prices) { if( prices.empty() || prices.size() prices[i] mi ? res:prices[i] mi; mi = mi 阅读全文
摘要:
```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 ... 阅读全文