My IsIsogram(FString) solution

{
	//treat 0 or 1 letter "words" as an isogram
	if (Guess.length() < 2) { return true; }

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

	//run through the whole word
	//auto pozwala "Zgadnąć" kompilatorowi typ zmiennej podczas kompilacji, nie zalecane przy interfejsach, ok przy logice
	for (auto Letter : Guess) //for all letters of the guess
	{
		Letter = tolower(Letter);
		//in map - check if character was mentioned in the map
		// if character is present in the map  - return false
		if (LetterSeen[Letter]) { return false; }
		//if character is not in the map, add it
		else { LetterSeen[Letter] = true; }	
	}

	return true;
}

Privacy & Terms