We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5eafaa7 + 7813855 commit 9dd663eCopy full SHA for 9dd663e
README.md
@@ -690,6 +690,23 @@ class Solution:
690
from itertools import combinations
691
return sum([list(combinations(nums, i)) for i in range(len(nums) + 1)], [])
692
```
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
706
+def search(nums: [int], target: int) -> bool:
707
+ return target in nums
708
709
710
## [83. Remove Duplicates from Sorted List 3行](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)
711
```python
712
# Definition for singly-linked list.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments