My Thoughts

Logic:

My thought is to loop through each character looking only at remaining characters to the right of it. If we have already successfully tested a character then it appears redundant to compare it again to the ones that it was already tested to.

Example:

bool FBullCowGame::CheckIfIsogram(FString Guess) const { 
	int32 GuessLength = Guess.length();
	for (int32 i = 0; i < GuessLength; i++)
	{
		for (int32 j = i + 1; j <= GuessLength -1; j++)
		{
			std::cout << "Checking: " << Guess[i] << " against " << Guess[j] << "\n";
			if (Guess[i] == Guess[j])
			{
				return false;
			}
		}
	}
	return true;
 }

Returns:

Try1. Enter your guess: pet
Checking: p against e
Checking: p against t
Checking: e against t

** Now knowing about mappings above no longer seems best lol.

Privacy & Terms