Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _Bool areAnagrams(const char* strA, const char* strB) {
- char *pomA = strA;
- char *pomB = strB;
- int pole[26] = {0}, pole2[26] = {0};
- int i = 0, j =0;
- while(*pomA != '\0') {
- pole[strA[i]-'a']++;
- i++;
- pomA++;
- }
- while(*pomB != '\0') {
- pole2[strB[j]-'a']++;
- j++;
- pomB++;
- }
- for (i = 0; i < 26; i++){
- if (pole[i] != pole2[i]){
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement