Easy C++ solution using simple Hash Table (Beginner friendly solution)
Intuition\nInitialize an array H of size 26 with all elements set to 0. This array will be used to count the occurrences of each character in the first string s
# Intuition\nInitialize an array H of size 26 with all elements set to 0. This array will be used to count the occurrences of each character in the first string s.\n\nUse a loop to traverse through the characters of string s:\n\nIncrement the count for each character in the H array at the corresponding index (e.g., \'a\' is at index 0, \'b\' at index 1, and so on). Also, increment the variable l1, which will keep track of the length of string s.\nUse another loop to traverse through the characters of string t:\n\nDecrement the count for each character in the H array at the corresponding index.\nIncrement the variable l2, which will keep track of the length of string t.\nIf the count of any character in H becomes negative during this loop, it means that the character appears more times in t than it does in s. In this case, the function immediately returns false, as it is impossible for s and t to be anagrams.\nAfter the second loop, check if the lengths of s and t are different. If they are, it means that they have different numbers of characters and, therefore, cannot be anagrams. In this case, the function returns false.\n\nIf the function has not returned false until this point, it means that all characters in s and t have matched in count, and their lengths are the same. Therefore, the function returns true, indicating that s and t are anagrams of each other.\n\nIn summary, the code first counts the occurrences of each character in the first string s and then decrements those counts for the characters in the second string t. If all characters match in count and the lengths of s and t are the same, the function returns true, indicating that s and t are anagrams. Otherwise, it returns false.\n\n# Approach\nUsing simple hash table \n\n- time complexity:\nO(n)\n![7abc56.jpg](https://assets.leetcode.com/users/images/8efc84ae-1459-40ed-b064-7e633b8bfea9_1690817599.1278117.jpeg)\n\n# Code\n```\nclass Solution {\npublic:\n    bool isAnagram(string s, string t) {\n        int H[26]={0};\n        int i,l1=0,l2=0;\n        for(i=0;s[i]!=\'\\0\';i++){\n        H[s[i]-97]++;\n        l1++;\n        }\n        for(i=0;t[i]!=\'\\0\';i++)\n        {\n        H[t[i]-97]--;\n        l2++;\n        if(H[t[i]-97]<0)\n            return false;\n        }\n        if(l1!=l2)\n            return false;\n        return true;  \n    }\n};\n```
['C++']