Find All Duplicates in an Array
程序员文章站
2022-04-25 11:45:23
...
这题放在了中等难度中,确实莫名的简单,可能出题方没有考虑有三个数字重复的情况吧。
#442
#https://leetcode.com/problems/find-all-duplicates-in-an-array/description/
#2018.4.29
class Solution(object):
def findDuplicates(self, nums):
nums.sort()
outs = []
for i in range(0,len(nums)-1):
if nums[i]==nums[i+1]:
outs.append(nums[i])
return outs
推荐阅读
-
ES6中Array.find()和findIndex()函数的用法详解
-
【一天一道LeetCode】#26. Remove Duplicates from Sorted Array
-
LeetCode448 — Find All Numbers Disappeared in an Array
-
LeetCode442 — Find All Duplicates in an Array
-
leetcode 448. Find All Numbers Disappeared in an Array
-
LeetCode-448. Find All Numbers Disappeared in an Array
-
Leetcode 448. Find All Numbers Disappeared in an Array (python+cpp)
-
LeetCode之Find All Duplicates in an Array
-
438. Find All Anagrams in a String
-
BeautifulSoup中find和find_all的使用详解