leetcode LCP39 无人机方阵 python代码解法,自己探索解读下
from typing import List
from collections import Counter
class Solution:
def minimumSwitchingTimes(self, source: List[List[int]], target: List[List[int]]) -> int:
source, target = Counter(sum(source, [])), Counter(sum(target, []))
diff = source - target
return sum(diff.values())
sum将二维数组扁平化为一维数组
// sum实