IsIsogram challenge

This seems to work when I test it. Everything about trying to think this way makes my brain hurt. :frowning:

bool FBullCowGame::IsIsogram(FString Word) const
{
	if (Word.length() <= 1) { return true; }

	TMap <char, bool> LetterSeen;
	for (auto Letter : Word)  //for all letters of the word, colon means in 
	{
		Letter = tolower(Letter); //handles mixed case
		LetterSeen[Letter] = true;
		if (LetterSeen[Letter])
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	return true;
} 

Edit: aaaaand no. no that does not work. lol.

Take a look at this code: you’re first saying that you have seen the letter, THEN you are checking if you have seen the letter. You might want to think about adjusting the order of those two things… :slight_smile:

A second thing is that you are returning true after checking only a single letter. You can return false as soon as you see a duplicate letter, but otherwise make sure you check all the letters of the word before returning true.