IsIsogram() solution

bool FBullCowGame::IsIsogram(FString Word) const {

if (Word.length() <= 1) { return true; }

// set up a map
TMap <char, bool> LetterSeen;
for (auto Letter : Word) 
{
	Letter = tolower(Letter);
	if (LetterSeen[Letter] == true) { //if letter is in the map
		return false; 
	} 
	else {
		LetterSeen[Letter] = true; 
	}
}
return true;  //in case where /0 is entered

}

Privacy & Terms