更新时间:2022-12-09 19:00:12
简单地重新考虑您的任务:您必须找出一个数组是否是另一个数组的置换.为了解决这个问题,您只需要检查每个数组中有多少个零,一,...,99.也就是说,
Simply rethink your task: you have to find out if one array is a permutation of another. To solve this you have only to check how many zeros, ones, ..., 99s in each array. That is,
int count[100]
初始化为全零count[a[i]]
并递减count[b[i]]
count[]
由全零组成,则a []和b []是置换.int count[100]
be initialized to all zeroscount[a[i]]
and decrement count[b[i]]
count[]
consists of all zeroes then a[] and b[] are permutations.