My Implementation of IsIsogram

bool FBullCowGame::IsIsogram(FString Word) const
{
// treat 0 and 1 letter words as isograms
if (Word.length() <= 1)
{
return true;
}

// create the map
TMap <char, bool> LetterSeen;

for (auto Letter : Word) // for all letter of the word SIMILAR TO A FOR EACH LOOP
{
	Letter = tolower(Letter); // handle mixed case
	// loop through the guess
		// if that letter is in the map
	if (LetterSeen[Letter] == true)
	{
		// the word is not an isogram
		return false;
	}
	else
	{
		LetterSeen[Letter] = true;
	}
		// otherwise 
			// add letter to map as seen
}
return true; // for example where /0 is entered

}

Privacy & Terms