IsIsogram without using nested loops

Used an empty FString and just added to it. When found back in the new FString then duplicate was found. return false

bool UBullCowCartridge::IsIsogram(FString word) const
{
    FString isoGram = TEXT("");
    for (int32 i = 0; i < word.Len(); i++)
    {
        int32 index;
        isoGram.FindChar(word[i], index);
        if (index >= 0)
        {
            return false;
        }
        isoGram.AppendChar(word[i]);
    }
    return true;
}

Privacy & Terms