"ACM ICPC Team" challenge on Hackerrank... Easy?
Some improvements:

Combine loops

int maxTopics = 0;
int maxTeams = 0;
for(int i = 0; i &lt; numberOfMembers - 1; i++)
    for (int j = i + 1; j &lt; numberOfMembers; j++)
    {
        int numberOfTeamTopics 
            = NumberOfSetBits(new BitArray(numberOfTopics).Or(bitArray[i]).Or(bitArray[j]));

        if (numberOfTeamTopics &gt; maxTopics)
        {
            maxTopics = numberOfTeamTopics;
            maxTeams = 1;
        }
        else if (numberOfTeamTopics == maxTopics)
        {
            maxTeams++; 
        }
    }


Use a better algorithm for counting set bits

public static Int32 NumberOfSetBits(BitArray bitArray)
{
    Int32[] ints = new Int32[(bitArray.Count &gt;&gt; 5) + 1];
    bitArray.CopyTo(ints, 0);
    Int32 count = 0;

    // fix for not truncated bits in last integer that may have been set to true with SetAll()
    ints[ints.Length - 1] &amp;= ~(-1 &lt;&lt; (bitArray.Count % 32));

    for (Int32 i = 0; i &lt; ints.Length; i++)
    {
        Int32 c = ints[i];

        // magic (http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel)
        unchecked
        {
            c = c - ((c &gt;&gt; 1) &amp; 0x55555555);
            c = (c &amp; 0x33333333) + ((c &gt;&gt; 2) &amp; 0x33333333);
            c = ((c + (c &gt;&gt; 4) &amp; 0xF0F0F0F) * 0x1010101) &gt;&gt; 24;
        }
        count += c;
    }
    return count;
}


New execution time: 0.12 seconds.