Problem
Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.
Algorithm
Use an array to save the number that appeared and serach the missing number in the array.
Code
class Solution:def findDisappearedNumbers(self, nums: List[int]) -> List[int]:nums_size = len(nums)visit = [0] * (nums_size + 1)for num in nums:visit[num] = 1ans = []for i in range(1, nums_size + 1):if not visit[i]:ans.append(i)return ans