My IsIsogram Solution

Not sure why it took me this long to get on these discussions. I’ve been plugging away for a couple of days now and have had no issues so far (including this function). So far so good. Really enjoying the course.

IsIsogram

I had almost the same solution!

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

	TMap<char, bool> LetterSeen; 

	for (auto Letter : Word)
	{
		Letter = tolower(Letter);
		if (LetterSeen[Letter])
		{
			return false;
		}
		LetterSeen[Letter] = true;
	}

	return true;
}

The else bracket is a little unnecessary here since the function quits at the “return false;”, but it definitely improves clearance. I’m just going to continue the video to see how Ben solved it.

Privacy & Terms