448. Find All Numbers Disappeared in an Array
[Medium] “Given an array of integers, find all the elements of [1, n] inclusive that do not appear in this array (where n = size of array)."
Python3:
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
res = list(range(1, len(nums) + 1))
for elem in nums:
res[elem - 1] = 0
return [x for x in res if x != 0]