bool canBeEqual(vector<int> &target, vector<int> &arr) {
unordered_map<int, int> window;
for (auto it:target)
window[it]++;
unordered_map<int, int> window1;
for (auto it:arr)
window1[it]++;
for (auto it:arr)
if (window1[it] != window[it])
return false;
return true;
}
1460. 通过翻转子数组使两个数组相等
最新推荐文章于 2024-04-08 00:05:15 发布