So far, i have came up with this. I have tried to minimize string operations and isolate solution to built in data types, arrays and integer operations.
I'm in search of much more elegant way to check for a pangram string, in java.
Elegant, as in minimum lines of code, other efficient algorithms are also welcome.
Please provide suggestions without lambda expressions.
private static boolean isPangrams(String ip) {
char[] characterArray = ip.toLowerCase().toCharArray();
int map[] = new int[26];
int sum = 0;
for(char current : characterArray) {
int asciiCode = (int) current;
if (asciiCode >= 97 && asciiCode <= 122) {
if (map[122 - asciiCode] == 0) {
sum += 1;
map[122 - asciiCode] = 1;
}
}
}
return sum == 26;
}