※ 引述《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:
: