✅ Java/C++/C# solution with explanation | O(n) time complexity
Approach\nThis solution checks whether two input strings, s and t, are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters 
# Approach\nThis solution checks whether two input strings, s and t, are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of another word or phrase, using all the original letters exactly once.\n\n1) Create a dictionary, dic, to store the frequency of each character in string s.\n2) Iterate through each character in string s, updating the dictionary  dic with the character frequencies.\n3) Iterate through each character in string t, decrementing the corresponding character\'s frequency in the dictionary dic. If a character in t is not found in dic, return false immediately, as it means t contains a character not present in s.\n4) After processing both strings, check if all values in the dictionary dic are equal to zero. If they are, return true; otherwise, return false.\n\n# Complexity\n![image.png](https://assets.leetcode.com/users/images/39ecad16-58d6-48eb-8d80-cd28177f24a3_1696078152.304232.png)\n- Time complexity: O(n)\n- Space complexity: O(c)\nWhere c is the number of unique characters in string s. The space is used to store character frequencies in the dictionary dic. In the worst case, where all characters are unique, c is equal to the length of s.\n\n\n\n\n# Code\n```C# []\npublic class Solution {\n    public bool IsAnagram(string s, string t) {\n        var dic = new Dictionary<char, int>();\n        foreach (var character in s)\n        {\n            if(dic.ContainsKey(character))\n                dic[character] += 1;\n            else\n                dic.Add(character, 1);\n        }\n\n        foreach (var character in t)\n        {\n            if(dic.ContainsKey(character))\n                dic[character] -= 1;\n            else\n                return false;\n        }\n\n        if(dic.Values.All(v => v == 0))\n            return true;\n        else\n            return false;\n    }\n}\n```\n```C++ []\nclass Solution {\npublic:\n    bool isAnagram(string s, string t) {\n        unordered_map<char, int> dic;\n        \n        for (char character : s) {\n            if (dic.find(character) != dic.end()) {\n                dic[character] += 1;\n            } else {\n                dic[character] = 1;\n            }\n        }\n\n        for (char character : t) {\n            if (dic.find(character) != dic.end()) {\n                dic[character] -= 1;\n                if (dic[character] < 0) {\n                    return false;\n                }\n            } else {\n                return false;\n            }\n        }\n\n        for (const auto& pair : dic) {\n            if (pair.second != 0) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n};\n\n```\n```Java []\nclass Solution {\n    public boolean isAnagram(String s, String t) {\n        Map<Character, Integer> dic = new HashMap<>();\n        \n        for (char character : s.toCharArray()) {\n            dic.put(character, dic.getOrDefault(character, 0) + 1);\n        }\n\n        for (char character : t.toCharArray()) {\n            if (dic.containsKey(character)) {\n                dic.put(character, dic.get(character) - 1);\n                if (dic.get(character) < 0) {\n                    return false;\n                }\n            } else {\n                return false;\n            }\n        }\n\n        for (int count : dic.values()) {\n            if (count != 0) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n}\n\n```\n\n## If you found it helpful, please consider giving it an upvote. Happy coding!\n
['C++', 'Java', 'C#']