My Isogram function (Part 2) code check version

Hello!
Here is my improved Isogram function made by a different way :slight_smile:

bool UBullCowCartridge::IsIsogram(FString word) const
{
    for (int Index = 0; Index < word.Len(); Index++)
    {
        for (int Comparison = 0; Comparison < word.Len(); Comparison++)
        {
            if (Index != Comparison) // Avoids same integer of Index and Comparison to be compared.
            {
                if (word[Index] == word[Comparison])
                {
                    return true;
                }                    
            }
        }         
    }

    return false;
}

I tried to check every letter (from the first one to the last one) just for make it a bit more difficult.
And making sure that Comparison and Index’s values are not the same to avoid an issue that I found (which regardless the word I type, always shows “No repeating letters” in the Bull & Cows videogame.

2 Likes

What made you make this improved version? Great job, btw!

1 Like

Thank you very much, Kevin! :grinning:

Privacy & Terms