You are viewing a single comment's thread. Return to all comments →
TC: O(n) | SC: O(1)
string pangrams(string s) { int count = 0; int arr[26] = {0};
for (size_t i = 0; i < s.size(); i++) { if (isalpha(s[i])) { int idx = tolower(s[i]); if (!arr[idx - 'a']){ count ^= idx; arr[idx - 'a'] = 1; } } } return count == 27 ? "pangram" : "not pangram";
}
Seems like cookies are disabled on this browser, please enable them to open this website
Pangrams
You are viewing a single comment's thread. Return to all comments →
TC: O(n) | SC: O(1)
string pangrams(string s) { int count = 0; int arr[26] = {0};
}