Leetcode 242 Solution

This article provides solution to leetcode question 242 (valid-anagram)

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; } };