```
class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
ans = []
if nums:
s = set()
for x in nums:
if x in s:
ans.append(x)
s.add(x)
n = len(nums)
ans.append( sum(range(1,n+1)) - sum(s) )
return ans
```