Hello! Before watching the two videos regarding checking characters, I worked out a solution that does work. The difference is that every character is checked against every character including itself. So obviously, it is less efficient for the purposes of this game. I was just wondering if anyone knew of an instance where this method might be useful.
bool UBullCowCartridge::IsIsogram(FString Word) const
{
for (int32 i = 0; i < Word.Len(); i++)
{
for (int32 j = 0; j < Word.Len(); j++)
{
if (Word[i] == Word[j] && i != j)
{
return false;
}
}
}
return true;
}
I ignored the times where the function checks the same index by adding it as a condition in my if statement. So does anyone know when this style might be useful?