Leetcode 242 Solution
This article provides solution to leetcode question 242 (valid-anagram)
Access this page by simply typing in "lcs 242" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/valid-anagram
Solution
class Solution {
public:
bool isAnagram(string s, string t) {
if (s.size() != t.size())
return false;
if (s.size() == 0)
return true;
sort(s.begin(), s.end());
sort(t.begin(), t.end());
return s == t;
}
};