Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. _Bool areAnagrams(const char* strA, const char* strB) {
  2. char *pomA = strA;
  3. char *pomB = strB;
  4.  
  5. int pole[26] = {0}, pole2[26] = {0};
  6. int i = 0, j =0;
  7.  
  8. while(*pomA != '\0') {
  9. pole[strA[i]-'a']++;
  10. i++;
  11. pomA++;
  12. }
  13.  
  14. while(*pomB != '\0') {
  15. pole2[strB[j]-'a']++;
  16. j++;
  17. pomB++;
  18. }
  19.  
  20. for (i = 0; i < 26; i++){
  21. if (pole[i] != pole2[i]){
  22. return false;
  23. }
  24. }
  25. return true;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement