Python - Find all numbers disappeared in an Array


  • 0
    S

    '''
    from collections import Counter
    class Solution(object):
    def findDisappearedNumbers(self, nums):
    """
    :type nums: List[int]
    :rtype: List[int]
    """
    final = []
    num_len = len(nums) + 1
    nums = Counter(nums)
    nums
    for num in range(1, num_len):
    if num not in nums:
    final.append(num)
    return final
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.