2-Liner Python


  • 0
    def findErrorNums(self, nums):
        c = collections.Counter(nums)
        return [val for val, count in c.items() if count == 2] + [i for i in range(1, len(nums)+1) if i not in c]

Log in to reply
 

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