Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7813855

Browse files
committed
add 80 & 81
1 parent 1c3c13e commit 7813855

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,23 @@ class Solution:
690690
from itertools import combinations
691691
return sum([list(combinations(nums, i)) for i in range(len(nums) + 1)], [])
692692
```
693+
694+
## [80. 删除排序数组中的重复项 II 4行](https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array-ii/)
695+
```python
696+
def removeDuplicates(nums: [int]) -> int:
697+
for i in range(len(nums)-3, -1, -1):
698+
if nums[i] == nums[i+1] and nums[i] == nums[i+2]:
699+
nums.pop(i)
700+
return len(nums)
701+
```
702+
- 从尾部开始考虑
703+
704+
## [81. 搜索旋转排序数组 II 1行](https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/)
705+
```python
706+
def search(nums: [int], target: int) -> bool:
707+
return target in nums
708+
```
709+
693710
## [83. Remove Duplicates from Sorted List 3行](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)
694711
```python
695712
# Definition for singly-linked list.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /