※ 引述《JerryChungYC (JerryChung)》之铭言:
: https://leetcode.com/problems/set-mismatch
: 645. Set Mismatch
: 有一组1~n的整数set,但有一个数字重复与一个数字丢失了,找出重复与缺失的数回传。
: Example 1:
: Input: nums = [1,2,2,4]
: Output: [2,3]
: Example 2:
: Input: num = [1,1]
: Output: [1,2]
: 思路:
: 1. 做一个1~n组成的set,利用差集找出缺失的数
: 2. 用Counter找出出现2次的数
: Python3 code:
: