leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0242.cpp (362B)


0 class Solution {
1 public:
2 bool isAnagram(string s, string t) {
3 if (s.size() != t.size()) return false;
4 vector<int> um(26, 0);
5 for (char c : s)
6 um[c - 'a']++;
7 for (char c : t)
8 if (!um[c - 'a'])
9 return false;
10 else
11 um[c - 'a']--;
12 return true;
13 }
14 };