hi ,
i did two implemantions of isogram ; (showing only the second implemantation for clarity)
- one with classic two loops and checking a character against the other characters
- second has a loop and uses a member function FindLastChar() which return position of the last occurence of a given character in a string. The logic is
if the position of a character is not equal to last occurence then it is an Isogram
bool UBullCowCartridge::IsIsogram(const FString& Guess)
{
int32 pos{0};
for(int i=0; i<Guess.Len(); ++i)
{
Guess.FindLastChar(Guess[i], pos);
if(pos != i) return true;
}
return false;
}