We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d958263 commit 861bfbcCopy full SHA for 861bfbc
valid-anagram/dylan-jung.cpp
@@ -0,0 +1,14 @@
1
+class Solution {
2
+public:
3
+ bool isAnagram(string s, string t) {
4
+ if(s.size() != t.size()) return false;
5
+ unordered_map<char, int> m1;
6
+ unordered_map<char, int> m2;
7
+ for(char c: s) m1[c]++;
8
+ for(char c: t) m2[c]++;
9
+ for(auto const& item: m1) {
10
+ if(m2[item.first] != item.second) return false;
11
+ }
12
+ return true;
13
14
+};
0 commit comments