Skip to content

Instantly share code, notes, and snippets.

@olumidayy
Last active March 27, 2020 12:02
Show Gist options
  • Save olumidayy/b0a812210b94c363e65938c9e2d8d021 to your computer and use it in GitHub Desktop.
Save olumidayy/b0a812210b94c363e65938c9e2d8d021 to your computer and use it in GitHub Desktop.
day3
void main() {
print(isIsogram2('qw- - e rty'));
print(isIsogram('qw- - e rty'));
}
String letters = 'abcdefghijklmnopqrstuvwxyz';
bool isIsogram(String word){
String newStr = '';
for(int i = 0; i < word.length; i++){
var letter = word[i];
if(newStr.contains(letter) && letters.contains(letter)){
return false;
}else{
newStr += letter;
}
}
return true;
}
bool isIsogram2(word){
for(int i = 0; i < word.length; i++){
var letter = word[i];
if(word.indexOf(letter) != word.lastIndexOf(letter) && letters.contains(letter)){
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment