My IsIsogram function

This is my code for the IsIsogram function

bool FBullCowGame::IsIsogram(FString Word) const
{	
	if (Word.length() <= 1) { return true; }	// Treat 0 and 1 letter words as isograms
	
	TMAP<char, bool> LetterSeen;				// Setup our map
	for (auto Letter : Word) {					// For all letters of the word
		Letter = tolower(Letter);
		if (LetterSeen[Letter] == true) {		// If the letter is in the map
			return false;						// We do NOT have an isogram
		}
		else {									// Add the letter to the map as seen
			LetterSeen[Letter] = true;
		}				
	}
	return true;								// For example in cases like /0
}

Privacy & Terms