Skip to content

Commit edc7583

Browse files
authored
Add files via upload
1 parent eec99a5 commit edc7583

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Solution {
2+
public:
3+
bool canBeEqual(vector<int>& target, vector<int>& arr) {
4+
map<int, int> mp;
5+
for (int x = 0; x < target.size(); ++x) {
6+
mp[target[x]] += 1;
7+
}
8+
9+
10+
for (int x = 0; x < arr.size(); ++x) {
11+
if (mp[arr[x]] == 0) {
12+
return false;
13+
}
14+
else {
15+
mp[arr[x]] -= 1;
16+
}
17+
}
18+
19+
return true;
20+
}
21+
};

0 commit comments

Comments
 (0)